# HG changeset patch # User Sam Lantinga # Date 1142125070 0 # Node ID 3968f7cba10c109e45f60a2278aa529fb1cd9f92 # Parent 420b3f47806de71a9d195e8bf811475b8a1bb1b9 Fixed bug #149 diff -r 420b3f47806d -r 3968f7cba10c src/video/wincommon/SDL_sysevents.c --- a/src/video/wincommon/SDL_sysevents.c Sat Mar 11 23:46:45 2006 +0000 +++ b/src/video/wincommon/SDL_sysevents.c Sun Mar 12 00:57:50 2006 +0000 @@ -746,6 +746,7 @@ /* Only do this once... */ if ( app_registered ) { + ++app_registered; return(0); } @@ -822,12 +823,17 @@ 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; } }