# HG changeset patch # User Ryan C. Gordon # Date 1072056080 0 # Node ID 26ac9609211f389ff6c0a25945d00d06795e51fc # Parent 619fc21d154e13b0374d4088aee44b5e070fc187 From: Thomas Jarosch To: Ryan C. Gordon Subject: SDL: DirectFB videodriver segfault Date: Sun, 21 Dec 2003 20:40:14 +0100 Hi Ryan, attached is a patch to fix a segfault in DirectFB_VideoQuit. When SetVideoMode never gets called (f.e. wrong command line arguments for "testsprite"), this->screen->hwdata is NULL. Cheers, Thomas diff -r 619fc21d154e -r 26ac9609211f src/video/directfb/SDL_DirectFB_video.c --- a/src/video/directfb/SDL_DirectFB_video.c Thu Dec 18 05:01:47 2003 +0000 +++ b/src/video/directfb/SDL_DirectFB_video.c Mon Dec 22 01:21:20 2003 +0000 @@ -1075,14 +1075,21 @@ void DirectFB_VideoQuit(_THIS) { struct DirectFBEnumRect *rect = enumlist; - IDirectFBSurface *surface = this->screen->hwdata->surface; - IDirectFBPalette *palette = this->screen->hwdata->palette; + + if (this->screen->hwdata) + { + IDirectFBSurface *surface = this->screen->hwdata->surface; + IDirectFBPalette *palette = this->screen->hwdata->palette; - if (palette) - palette->Release (palette); + if (palette) + palette->Release (palette); - if (surface) - surface->Release (surface); + if (surface) + surface->Release (surface); + + this->screen->hwdata->surface = NULL; + this->screen->hwdata->palette = NULL; + } if (HIDDEN->c2frame) {