src/video/wincommon/SDL_sysevents.c
changeset 1498 3968f7cba10c
parent 1497 420b3f47806d
child 1505 4d005dfbb7f5
--- 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;
 	}
 }