diff src/video/win32/SDL_win32window.c @ 3045:9acb9f0f7f0d

Some more safety around the SDL_HelperWindow stuff to avoid double creations.
author Edgar Simo <bobbens@gmail.com>
date Sun, 18 Jan 2009 17:00:02 +0000
parents 502adab079a4
children 089a77aebb7d
line wrap: on
line diff
--- a/src/video/win32/SDL_win32window.c	Thu Jan 15 21:35:42 2009 +0000
+++ b/src/video/win32/SDL_win32window.c	Sun Jan 18 17:00:02 2009 +0000
@@ -561,6 +561,11 @@
     HINSTANCE hInstance = GetModuleHandleA(NULL);
     WNDCLASSEX wce;
 
+    /* Make sure window isn't created twice. */
+    if (SDL_HelperWindow != NULL) {
+        return 0;
+    }
+
     /* Create the class. */
     SDL_zero(wce);
     wce.cbSize = sizeof(WNDCLASSEX);
@@ -584,6 +589,7 @@
                                       CW_USEDEFAULT, HWND_MESSAGE, NULL,
                                       hInstance, NULL);
     if (SDL_HelperWindow == NULL) {
+        UnregisterClass(SDL_HelperWindowClassName, hInstance);
         SDL_SetError("Unable to create Helper Window: error %d.",
                      GetLastError());
         return -1;