Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Some more safety around the SDL_HelperWindow stuff to avoid double cr…
Browse files Browse the repository at this point in the history
…eations.
  • Loading branch information
bobbens committed Jan 18, 2009
1 parent 8d65a9c commit cef9aba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/video/win32/SDL_win32window.c
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit cef9aba

Please sign in to comment.