From 2d90a13bcb912bf68e9e9cb06614c1acee30714d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Mar 2006 00:57:50 +0000 Subject: [PATCH] Fixed bug #149 --- src/video/wincommon/SDL_sysevents.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/video/wincommon/SDL_sysevents.c b/src/video/wincommon/SDL_sysevents.c index 0f7765ff2..977f128af 100644 --- a/src/video/wincommon/SDL_sysevents.c +++ b/src/video/wincommon/SDL_sysevents.c @@ -746,6 +746,7 @@ int SDL_RegisterApp(char *name, Uint32 style, void *hInst) /* Only do this once... */ if ( app_registered ) { + ++app_registered; return(0); } @@ -822,12 +823,17 @@ void SDL_UnregisterApp() WNDCLASS class; /* SDL_RegisterApp might not have been called before */ - if ( app_registered ) { + if ( !app_registered ) { + return; + } + --app_registered; + if ( app_registered == 0 ) { /* Check for any registered window classes. */ if ( GetClassInfo(SDL_Instance, SDL_Appname, &class) ) { UnregisterClass(SDL_Appname, SDL_Instance); } - app_registered = 0; + SDL_free(SDL_Appname); + SDL_Appname = NULL; } }