changeset 1498:3968f7cba10c

Fixed bug #149
author Sam Lantinga <slouken@libsdl.org>
date Sun, 12 Mar 2006 00:57:50 +0000
parents 420b3f47806d
children ad887c988713
files src/video/wincommon/SDL_sysevents.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;
 	}
 }