<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:robert.folland@me.com" title="Robert Folland <robert.folland@me.com>"> <span class="fn">Robert Folland</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - SIGSEGV in xkb_context_ref from /usr/lib/libxkbcommon.so.0"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=94075">bug 94075</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">OS</td>
           <td>All
           </td>
           <td>Linux (All)
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>NOTABUG
           </td>
           <td>---
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Hardware</td>
           <td>x86 (IA32)
           </td>
           <td>x86-64 (AMD64)
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Component</td>
           <td>libinput
           </td>
           <td>wayland
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - SIGSEGV in xkb_context_ref from /usr/lib/libxkbcommon.so.0"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=94075#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - SIGSEGV in xkb_context_ref from /usr/lib/libxkbcommon.so.0"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=94075">bug 94075</a>
              from <span class="vcard"><a class="email" href="mailto:robert.folland@me.com" title="Robert Folland <robert.folland@me.com>"> <span class="fn">Robert Folland</span></a>
</span></b>
        <pre>Hi,
I am still getting segfaults when initializing SDL on wayland. I avoided the
problem with a watchdog which would kill and restart my program in case of a
crash. But I would prefer to get it fixed.
I made a very simple example which calls SDL_Init and SDL_Quit with a pause in
between. Running this loop 100 times will result in a segmentation fault. I am
running weston/wayland on arch linux on an Intel NUC.

Here is the example program:

#include <stdlib.h>
#include <SDL2/SDL.h>
#include <unistd.h>
#include <iostream>

int main(int argc, char **argv)
{
    int count = atoi(argv[1]);

    for (int i = 0; i < count; i++) {
        std::cout << "Init " << i << std::endl;
        if (SDL_Init(SDL_INIT_VIDEO) < 0) {
            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
                         "Couldn't initialize SDL: %s\n",
                         SDL_GetError());
            return 1;
        }
        sleep(1);
        std::cout << "Quit" << std::endl;
        SDL_Quit();
        sleep(1);
    }
    return 0;
}

And here is a backtrace from running the program with gdb:


Init 70
Quit
Init 71
Quit
Init 72
Quit
Init 73
Quit
Init 74

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff1cfdcd3 in xkb_context_ref () from /usr/lib/libxkbcommon.so.0
(gdb) bt
#0  0x00007ffff1cfdcd3 in xkb_context_ref () from /usr/lib/libxkbcommon.so.0
#1  0x00007ffff1cffeb9 in ?? () from /usr/lib/libxkbcommon.so.0
#2  0x00007ffff1cff7fc in xkb_keymap_new_from_buffer ()
   from /usr/lib/libxkbcommon.so.0
#3  0x00007ffff710010e in ?? () from /usr/lib/libSDL2-2.0.so.0
#4  0x00007ffff23331f0 in ffi_call_unix64 () from /usr/lib/libffi.so.6
#5  0x00007ffff2332c58 in ffi_call () from /usr/lib/libffi.so.6
#6  0x00007ffff253ee5e in ?? () from /usr/lib/libwayland-client.so.0
#7  0x00007ffff253bc30 in ?? () from /usr/lib/libwayland-client.so.0
#8  0x00007ffff253ce1c in wl_display_dispatch_queue_pending ()
   from /usr/lib/libwayland-client.so.0
#9  0x00007ffff253d12f in wl_display_roundtrip_queue ()
   from /usr/lib/libwayland-client.so.0
#10 0x00007ffff7101160 in ?? () from /usr/lib/libSDL2-2.0.so.0
#11 0x00007ffff70ec589 in ?? () from /usr/lib/libSDL2-2.0.so.0
#12 0x00007ffff7050f47 in ?? () from /usr/lib/libSDL2-2.0.so.0
#13 0x0000000000400bde in main (argc=<optimized out>, argv=<optimized out>)
    at vplay-init.cpp:13
(gdb)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>