]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/nativewin.cpp
fix crash which happened if you called SetAttr(NULL) followed by SetAttr(attr) (...
[wxWidgets.git] / src / msw / nativewin.cpp
index 1f0ddeca87811540ad77960a374633b0e0043c97..6b3649b842a3309eb64a5ffe23b04168b55278f4 100644 (file)
@@ -54,6 +54,27 @@ bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle hwnd)
     return true;
 }
 
+void wxNativeContainerWindow::OnNativeDestroyed()
+{
+    // don't use Close() or even Destroy() here, we really don't want to keep
+    // an object using a no more existing HWND around for longer than necessary
+    delete this;
+}
+
+WXLRESULT wxNativeContainerWindow::MSWWindowProc(WXUINT nMsg,
+                                                 WXWPARAM wParam,
+                                                 WXLPARAM lParam)
+{
+    if ( nMsg == WM_DESTROY )
+    {
+        OnNativeDestroyed();
+
+        return 0;
+    }
+
+    return wxTopLevelWindow::MSWWindowProc(nMsg, wParam, lParam);
+}
+
 wxNativeContainerWindow::~wxNativeContainerWindow()
 {
     // prevent the base class dtor from destroying the window, it doesn't