We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5196 - SDL_CreateRender can crash after SDL_PollEvent
Summary: SDL_CreateRender can crash after SDL_PollEvent
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.12
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-16 14:53 UTC by Jan Engelhardt
Modified: 2020-06-16 14:53 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Engelhardt 2020-06-16 14:53:56 UTC
Platform tested: openSUSE Leap 15.1
Version: SDL 2.0.12, which was built with --enable-ime.
Other components: ibus-1.5.19, dbus-1.12.2

Testcase:
#include <SDL2/SDL.h>
int main()
{
        SDL_InitSubSystem(SDL_INIT_VIDEO);
        SDL_Window *w = SDL_CreateWindow("", 0, 0, 640, 480, 0);
        bool trigger_crash = true;
        if (trigger_crash) {
                SDL_Event ev;
                do {
                } while (SDL_PollEvent(&ev) <= 0);
        }
        SDL_CreateRenderer(w, 0, SDL_WINDOW_OPENGL);
}


Crash/SIGSEGV.

(gdb) bt
#0  X11_GetWindowWMInfo (_this=0x61a130, window=0x7f4d70, info=0x7fffffffd220)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/video/x11/SDL_x11window.c:1665
#1  0x00007ffff7b6a709 in SDL_IBus_UpdateTextRect (rect=rect@entry=0x0)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/core/linux/SDL_ibus.c:538
#2  0x00007ffff7b6ae80 in IBus_MessageHandler (conn=<optimized out>, 
    msg=msg@entry=0x6684a0, user_data=user_data@entry=0x7ffff7dd3a60 <dbus>)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/core/linux/SDL_ibus.c:160
#3  0x00007ffff4874740 in _dbus_object_tree_dispatch_and_unlock (
    tree=0x666c50, message=message@entry=0x6684a0, 
    found_object=found_object@entry=0x7fffffffd458) at dbus-object-tree.c:1020
#4  0x00007ffff486552a in dbus_connection_dispatch (connection=0x666a10)
    at dbus-connection.c:4744
#5  0x00007ffff7b6b095 in SDL_IBus_PumpEvents ()
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/core/linux/SDL_ibus.c:576
#6  0x00007ffff7b52bc5 in X11_PumpEvents (_this=_this@entry=0x61a130)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/video/x11/SDL_x11events.c:1468
#7  0x00007ffff7b58b67 in X11_GL_InitExtensions (_this=0x61a130)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/video/x11/SDL_x11opengl.c:470
#8  X11_GL_LoadLibrary (_this=0x61a130, path=<optimized out>)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/video/x11/SDL_x11opengl.c:235
#9  0x00007ffff7b2a526 in SDL_GL_LoadLibrary_REAL (path=path@entry=0x0)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/video/SDL_video.c:2915
#10 0x00007ffff7b2a854 in SDL_RecreateWindow (window=window@entry=0x7f4d70, 
    flags=flags@entry=518)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/video/SDL_video.c:1680
#11 0x00007ffff7ac55c9 in GL_CreateRenderer (window=0x7f4d70, flags=2)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/render/opengl/SDL_render_gl.c:1592
#12 0x00007ffff7abff70 in SDL_CreateRenderer_REAL (window=0x7f4d70, index=0, 
    flags=2)
    at /usr/src/debug/SDL2-2.0.12-lp151.111.1.x86_64/src/render/SDL_render.c:837
#13 0x0000000000400709 in main () at x.cpp:12

frame 0.
1661    SDL_bool
1662    X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
1663    {
1664        SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1665>       Display *display = data->videodata->display;

driverdata is NULL because the window was already destroyed near the start of SDL_RecreateWindow.

Can you reproduce? If not, I'll write up a more detailed report.