From: Thomas Jarosch
authorRyan C. Gordon <icculus@icculus.org>
Mon, 22 Dec 2003 01:21:20 +0000
changeset 759 26ac9609211f
parent 758 619fc21d154e
child 760 cf9dd3aa6756
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
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)
     {