src/video/windows/SDL_windowswindow.c
changeset 5580 0c407e6d14a9
parent 5535 96594ac5fd1a
child 5581 f40f9d3ca2bc
--- a/src/video/windows/SDL_windowswindow.c	Fri Jul 22 00:12:03 2011 -0700
+++ b/src/video/windows/SDL_windowswindow.c	Mon Jul 25 15:03:42 2011 -0700
@@ -636,6 +636,15 @@
         ReleaseDC(data->hwnd, data->hdc);
         if (data->created) {
             DestroyWindow(data->hwnd);
+        } else {
+            /* Restore any original event handler... */
+            if (data->wndproc != NULL) {
+#ifdef GWLP_WNDPROC
+                SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) data->wndproc);
+#else
+                SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR) data->wndproc);
+#endif
+            }
         }
         SDL_free(data);
     }