Some more safety around the SDL_HelperWindow stuff to avoid double creations.
authorEdgar Simo <bobbens@gmail.com>
Sun, 18 Jan 2009 17:00:02 +0000
changeset 3045 9acb9f0f7f0d
parent 3044 b36579172f27
child 3046 47965eacde88
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
src/video/win32/SDL_win32window.c
--- 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;