Skip to content

Commit

Permalink
From: Thomas Jarosch
Browse files Browse the repository at this point in the history
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
  • Loading branch information
icculus committed Dec 22, 2003
1 parent c3e8c3d commit 0eb3525
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/video/directfb/SDL_DirectFB_video.c
Expand Up @@ -1075,14 +1075,21 @@ int DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
void DirectFB_VideoQuit(_THIS)
{
struct DirectFBEnumRect *rect = enumlist;
IDirectFBSurface *surface = this->screen->hwdata->surface;
IDirectFBPalette *palette = this->screen->hwdata->palette;

if (palette)
palette->Release (palette);
if (this->screen->hwdata)
{
IDirectFBSurface *surface = this->screen->hwdata->surface;
IDirectFBPalette *palette = this->screen->hwdata->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)
{
Expand Down

0 comments on commit 0eb3525

Please sign in to comment.