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

Commit

Permalink
Some error checking when destroying the HelperWindow.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Dec 12, 2008
1 parent 196fe95 commit 82878dc
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/video/win32/SDL_win32window.c
Expand Up @@ -522,15 +522,25 @@ SDL_HelperWindowCreate(void)
void
SDL_HelperWindowDestroy(void)
{
HINSTANCE hInstance = GetModuleHandleA(NULL);

/* Destroy the window. */
if (SDL_HelperWindow) {
DestroyWindow(SDL_HelperWindow);
if (SDL_HelperWindow != NULL) {
if (DestroyWindow(SDL_HelperWindow) == 0) {
SDL_SetError("Unable to destroy Helper Window: error %d.",
GetLastError());
return;
}
SDL_HelperWindow = NULL;
}

/* Unregister the class. */
if (SDL_HelperWindowClass) {
UnregisterClass(SDL_HelperWindowClassName, GetModuleHandleA(NULL));
if (SDL_HelperWindowClass != 0) {
if ((UnregisterClass(SDL_HelperWindowClassName, hInstance)) == 0) {
SDL_SetError("Unable to destroy Helper Window Class: error %d.",
GetLastError());
return;
}
SDL_HelperWindowClass = 0;
}
}
Expand Down

0 comments on commit 82878dc

Please sign in to comment.