diff src/video/win32/SDL_win32window.c @ 2863:b632927c28c8

Some error checking when destroying the HelperWindow.
author Edgar Simo <bobbens@gmail.com>
date Fri, 12 Dec 2008 15:51:57 +0000
parents 99210400e8b9
children 09adf4854163
line wrap: on
line diff
--- 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;
     }
 }