Commit d2d5573e authored by Ryan C. Gordon's avatar Ryan C. Gordon

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

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40760
parent 5e87c6c2
...@@ -1075,6 +1075,9 @@ int DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) ...@@ -1075,6 +1075,9 @@ int DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
void DirectFB_VideoQuit(_THIS) void DirectFB_VideoQuit(_THIS)
{ {
struct DirectFBEnumRect *rect = enumlist; struct DirectFBEnumRect *rect = enumlist;
if (this->screen->hwdata)
{
IDirectFBSurface *surface = this->screen->hwdata->surface; IDirectFBSurface *surface = this->screen->hwdata->surface;
IDirectFBPalette *palette = this->screen->hwdata->palette; IDirectFBPalette *palette = this->screen->hwdata->palette;
...@@ -1084,6 +1087,10 @@ void DirectFB_VideoQuit(_THIS) ...@@ -1084,6 +1087,10 @@ void DirectFB_VideoQuit(_THIS)
if (surface) if (surface)
surface->Release (surface); surface->Release (surface);
this->screen->hwdata->surface = NULL;
this->screen->hwdata->palette = NULL;
}
if (HIDDEN->c2frame) if (HIDDEN->c2frame)
{ {
HIDDEN->c2frame->Release (HIDDEN->c2frame); HIDDEN->c2frame->Release (HIDDEN->c2frame);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment