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 2818

Summary: SDL_ShowWindow() may end up a no-op
Product: SDL Reporter: Max Reitz <xanclic>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   
Attachments: Test case which should end up with the window being shown
Fixed test case with SDL_Init() and SDL_Quit()
Test case which should end up with the window being shown; now hopefully with correct SDL_Init() and SDL_Quit()

Description Max Reitz 2014-12-12 09:31:56 UTC
Created attachment 1969 [details]
Test case which should end up with the window being shown

Using X under Fedora 20, the attached test case does not end up with the window shown.

This seems to be the case because during the second SDL_PollEvent() loop, an X event is received by SDL which causes SDL to send an SDL_WINDOWEVENT_SHOWN (which somehow does not actually result in the window shown, however), and this then leads to SDL_ShowWindow() assuming that the window is already visible ("if (window->flags & SDL_WINDOW_SHOWN)").

This is a stack trace for the SDL-2.0.4-9267 tarball:

#0  SDL_SendWindowEvent (window=0x555556738ff0, windowevent=<optimized out>, data1=0, data2=0) at /tmp/SDL-2.0.4-9267/src/events/SDL_windowevents.c:87
#1  0x00007ffff39de4c6 in X11_DispatchMapNotify (data=<optimized out>) at /tmp/SDL-2.0.4-9267/src/video/x11/SDL_x11events.c:381
#2  X11_DispatchEvent (_this=_this@entry=0x55555627e7f0) at /tmp/SDL-2.0.4-9267/src/video/x11/SDL_x11events.c:1099
#3  0x00007ffff39df3a8 in X11_PumpEvents (_this=0x55555627e7f0) at /tmp/SDL-2.0.4-9267/src/video/x11/SDL_x11events.c:1309
#4  0x00007ffff3952db9 in SDL_PumpEvents_REAL () at /tmp/SDL-2.0.4-9267/src/events/SDL_events.c:388
#5  SDL_WaitEventTimeout_REAL (timeout=0, event=0x7fffffffd6f0) at /tmp/SDL-2.0.4-9267/src/events/SDL_events.c:421
#6  SDL_PollEvent_REAL (event=0x7fffffffd6f0) at /tmp/SDL-2.0.4-9267/src/events/SDL_events.c:403
Comment 1 Max Reitz 2014-12-12 12:13:10 UTC
Created attachment 1970 [details]
Fixed test case with SDL_Init() and SDL_Quit()
Comment 2 Max Reitz 2014-12-12 12:15:20 UTC
Created attachment 1971 [details]
Test case which should end up with the window being shown; now hopefully with correct SDL_Init() and SDL_Quit()
Comment 3 Max Reitz 2017-11-14 14:46:15 UTC
Hi,

Checking again, this issue seems to haven been fixed by revision 11151:7cfe088fafba.


Thanks!

Max

*** This bug has been marked as a duplicate of bug 3410 ***