Some error checking when destroying the HelperWindow.
authorEdgar Simo <bobbens@gmail.com>
Fri, 12 Dec 2008 15:51:57 +0000
changeset 2863 b632927c28c8
parent 2862 929e7dd10031
child 2864 fe8ea2b39aea
Some error checking when destroying the HelperWindow.
src/video/win32/SDL_win32window.c
--- a/src/video/win32/SDL_win32window.c	Fri Dec 12 06:46:20 2008 +0000
+++ b/src/video/win32/SDL_win32window.c	Fri Dec 12 15:51:57 2008 +0000
@@ -522,15 +522,25 @@
 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;
     }
 }