Commit cf3db869 authored by Edgar Simo's avatar Edgar Simo

Some more safety around the SDL_HelperWindow stuff to avoid double creations.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403508
parent ffe056ff
...@@ -561,6 +561,11 @@ SDL_HelperWindowCreate(void) ...@@ -561,6 +561,11 @@ SDL_HelperWindowCreate(void)
HINSTANCE hInstance = GetModuleHandleA(NULL); HINSTANCE hInstance = GetModuleHandleA(NULL);
WNDCLASSEX wce; WNDCLASSEX wce;
/* Make sure window isn't created twice. */
if (SDL_HelperWindow != NULL) {
return 0;
}
/* Create the class. */ /* Create the class. */
SDL_zero(wce); SDL_zero(wce);
wce.cbSize = sizeof(WNDCLASSEX); wce.cbSize = sizeof(WNDCLASSEX);
...@@ -584,6 +589,7 @@ SDL_HelperWindowCreate(void) ...@@ -584,6 +589,7 @@ SDL_HelperWindowCreate(void)
CW_USEDEFAULT, HWND_MESSAGE, NULL, CW_USEDEFAULT, HWND_MESSAGE, NULL,
hInstance, NULL); hInstance, NULL);
if (SDL_HelperWindow == NULL) { if (SDL_HelperWindow == NULL) {
UnregisterClass(SDL_HelperWindowClassName, hInstance);
SDL_SetError("Unable to create Helper Window: error %d.", SDL_SetError("Unable to create Helper Window: error %d.",
GetLastError()); GetLastError());
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment