If we didn't create win32 window, restore its event procedure on destruction.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 25 Jul 2011 15:03:42 -0700
changeset 5580 0c407e6d14a9
parent 5579 c8862e1bc41f
child 5581 f40f9d3ca2bc
If we didn't create win32 window, restore its event procedure on destruction.
src/video/windows/SDL_windowswindow.c
--- 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);
     }