mirror of
https://github.com/yawut/SDL.git
synced 2026-04-19 15:17:23 -05:00
Some more safety around the SDL_HelperWindow stuff to avoid double creations.
This commit is contained in:
parent
d3dee2dd2b
commit
bbcab32cb1
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user