Mercurial > sdl-ios-xcode
diff src/video/directfb/SDL_DirectFB_video.c @ 759:26ac9609211f
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
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 22 Dec 2003 01:21:20 +0000 |
parents | d18e2b224d0e |
children | d9e79e31a7b7 |
line wrap: on
line diff
--- 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) {