From ce0869a625ceb4f9b59dc0f9a7ac43707257d630 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 19 Jun 2001 21:07:12 +0000 Subject: [PATCH] Don't crash if freeing a cursor after quit... --- src/video/SDL_cursor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/video/SDL_cursor.c b/src/video/SDL_cursor.c index d72f029c9..a00b7232e 100644 --- a/src/video/SDL_cursor.c +++ b/src/video/SDL_cursor.c @@ -245,15 +245,16 @@ void SDL_FreeCursor (SDL_Cursor *cursor) SDL_SetCursor(SDL_defcursor); } if ( cursor != SDL_defcursor ) { + SDL_VideoDevice *video = current_video; + SDL_VideoDevice *this = current_video; + if ( cursor->data ) { free(cursor->data); } if ( cursor->save[0] ) { free(cursor->save[0]); } - if ( cursor->wm_cursor ) { - SDL_VideoDevice *video = current_video; - SDL_VideoDevice *this = current_video; + if ( video && cursor->wm_cursor ) { video->FreeWMCursor(this, cursor->wm_cursor); } free(cursor);