Don't crash if freeing a cursor after quit...
authorSam Lantinga <slouken@lokigames.com>
Tue, 19 Jun 2001 21:07:12 +0000
changeset 771e7e61b9b0f9
parent 76 f28fa29a3a0c
child 78 e9582f471c02
Don't crash if freeing a cursor after quit...
src/video/SDL_cursor.c
     1.1 --- a/src/video/SDL_cursor.c	Tue Jun 19 13:35:05 2001 +0000
     1.2 +++ b/src/video/SDL_cursor.c	Tue Jun 19 21:07:12 2001 +0000
     1.3 @@ -245,15 +245,16 @@
     1.4  			SDL_SetCursor(SDL_defcursor);
     1.5  		}
     1.6  		if ( cursor != SDL_defcursor ) {
     1.7 +			SDL_VideoDevice *video = current_video;
     1.8 +			SDL_VideoDevice *this  = current_video;
     1.9 +
    1.10  			if ( cursor->data ) {
    1.11  				free(cursor->data);
    1.12  			}
    1.13  			if ( cursor->save[0] ) {
    1.14  				free(cursor->save[0]);
    1.15  			}
    1.16 -			if ( cursor->wm_cursor ) {
    1.17 -				SDL_VideoDevice *video = current_video;
    1.18 -				SDL_VideoDevice *this  = current_video;
    1.19 +			if ( video && cursor->wm_cursor ) {
    1.20  				video->FreeWMCursor(this, cursor->wm_cursor);
    1.21  			}
    1.22  			free(cursor);