From cef9aba5fb71ee77f60e65d83f3b5a5090c10a28 Mon Sep 17 00:00:00 2001 From: Edgar Simo Date: Sun, 18 Jan 2009 17:00:02 +0000 Subject: [PATCH] Some more safety around the SDL_HelperWindow stuff to avoid double creations. --- src/video/win32/SDL_win32window.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/video/win32/SDL_win32window.c b/src/video/win32/SDL_win32window.c index efa36e49b..a2b076fd4 100644 --- a/src/video/win32/SDL_win32window.c +++ b/src/video/win32/SDL_win32window.c @@ -561,6 +561,11 @@ SDL_HelperWindowCreate(void) 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 @@ SDL_HelperWindowCreate(void) 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;