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 571 - SDL crashes when xserevr disconnects.
Summary: SDL crashes when xserevr disconnects.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 1.2.10
Hardware: x86 Other
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-1.2.14
Depends on:
Blocks:
 
Reported: 2008-03-24 12:16 UTC by Mikulas Patocka
Modified: 2009-09-21 01:00 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikulas Patocka 2008-03-24 12:16:39 UTC
I got a crash when xserver terminated the connection (it happens only with small probability, the connection has to be terminated at certain point).

Crash happened in xio_errhandler due to SDL_VideoSurface being NULL.

This is the stack trace:
TARGET_LIB:/LIBSDL.A/SDL_X11VIDEO.O:xio_errhandler+1E, _XIOError+16, LIBX11.A/XLIBINT.O:_XFlushInt+13A, OBJ/UTHREAD.O:SET_READY+39, _XReply+5F, __FN_PREEMPT_AST+A2, XSync+4E, TARGET_LIB:/LIBSDL.A/SDL_X11VIDEO.O:X11_SetVideoMode+2E, SDL_SetVideoMode+172, _Z10mem_writewjt+55, _Z11GFX_SetSizejjjddPFv23GFX_CallBackFunctions_tE+357, X11_Pending+6D, GUI/LIBGUI.A/RENDER.O:_Z12RENDER_Resetv+1BE, _Z16VGA_SetupDrawingj+3F7, _Z12PIC_RunQueuev+E6, _Z13TIMER_AddTickv+56, DOSBOX.O:_Z11Normal_Loopv+C, _Z17DOSBOX_RunMachinev+9, _Z19CALLBACK_RunRealInth+44, _ZN10device_CON4ReadEPhPt+76, _ZN10DOS_Device4ReadEPhPt+16, _Z12DOS_ReadFiletPhPt+8E, _ZN9DOS_Shell12InputCommandEPc+6E, XrmStringToQuark+3B, _XlcGetLocaleDataBase+23, _ZNSs4_Rep9_S_createEjRKSaIcE+56, _ZNSt24__default_alloc_templateILb1ELi0EE10deallocateEPvj+43, _ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsRSsPSsE+41, _ZNSs15_M_replace_safeIN9__gnu_cxx17__normal_iteratorIPcSsEEEERSsS3_S3_T_S5_+42, _Z17DOS_GetCurrentDirhPc+42, _ZN9DOS_Shell10ShowPromptEv+43, _ZN9DOS_Shell9ParseLineEPc+B7, _ZNSs7replaceEjjPKcj+C3, _ZN9DOS_Shell3RunEv+CD, LIBX11.A/LCGENERIC.O:read_segmentconversion+7F, _Z10SHELL_Initv+713, _Znwj+19, _ZN5MOUNT3RunEv+19, vga_initf+1, _ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj+6F, _Znaj+8, _ZN13CKeyBindGroupC1Ej+92, _ZN11CommandLine9FindExistEPKcb+27, GUI/LIBGUI.A/SDL_MAPPER.O:_Z16CreateBindGroupsv+6E, _ZN6Config7StartUpEv+6, main+354

A possible patch (you need to check it that it really works):
--- src/video/x11/SDL_x11video.c_       2008-03-24 01:15:46.000000000 +0200
+++ src/video/x11/SDL_x11video.c        2008-03-24 01:15:51.000000000 +0200
@@ -232,7 +232,7 @@
        /* Ack!  Lost X11 connection! */

        /* We will crash if we try to clean up our display */
-       if ( current_video->hidden->Ximage ) {
+       if ( current_video->hidden->Ximage && SDL_VideoSurface ) {
                SDL_VideoSurface->pixels = NULL;
        }
        current_video->hidden->X11_Display = NULL;
Comment 1 Ryan C. Gordon 2009-09-13 16:33:39 UTC
Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14.

Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla).

--ryan.
Comment 2 Sam Lantinga 2009-09-21 01:00:05 UTC
Thanks, your patch certainly can't hurt!  I applied it to subversion.