changeset 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 b36579172f27
children 47965eacde88
files src/video/win32/SDL_win32window.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
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;