Skip to content

Commit

Permalink
Don't crash if freeing a cursor after quit...
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Lantinga committed Jun 19, 2001
1 parent c1c8eeb commit ce0869a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/video/SDL_cursor.c
Expand Up @@ -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);
Expand Down

0 comments on commit ce0869a

Please sign in to comment.