Some more safety around the SDL_HelperWindow stuff to avoid double creations.
authorEdgar Simo
Sun, 18 Jan 2009 17:00:02 +0000
changeset 30459acb9f0f7f0d
parent 3044 b36579172f27
child 3046 47965eacde88
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
src/video/win32/SDL_win32window.c
     1.1 --- a/src/video/win32/SDL_win32window.c	Thu Jan 15 21:35:42 2009 +0000
     1.2 +++ b/src/video/win32/SDL_win32window.c	Sun Jan 18 17:00:02 2009 +0000
     1.3 @@ -561,6 +561,11 @@
     1.4      HINSTANCE hInstance = GetModuleHandleA(NULL);
     1.5      WNDCLASSEX wce;
     1.6  
     1.7 +    /* Make sure window isn't created twice. */
     1.8 +    if (SDL_HelperWindow != NULL) {
     1.9 +        return 0;
    1.10 +    }
    1.11 +
    1.12      /* Create the class. */
    1.13      SDL_zero(wce);
    1.14      wce.cbSize = sizeof(WNDCLASSEX);
    1.15 @@ -584,6 +589,7 @@
    1.16                                        CW_USEDEFAULT, HWND_MESSAGE, NULL,
    1.17                                        hInstance, NULL);
    1.18      if (SDL_HelperWindow == NULL) {
    1.19 +        UnregisterClass(SDL_HelperWindowClassName, hInstance);
    1.20          SDL_SetError("Unable to create Helper Window: error %d.",
    1.21                       GetLastError());
    1.22          return -1;