X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b6dc21e7689cf7bf9ecf74701fbe2df8168d33ac..0f1c3d30d4a699817340ce56e752b61b78cccb1c:/src/osx/nonownedwnd_osx.cpp

diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp
index 9adc5647d5..017107215f 100644
--- a/src/osx/nonownedwnd_osx.cpp
+++ b/src/osx/nonownedwnd_osx.cpp
@@ -159,12 +159,26 @@ wxNonOwnedWindow::~wxNonOwnedWindow()
     DestroyChildren();
 
     delete m_nowpeer;
+    m_nowpeer = NULL;
 
     // avoid dangling refs
     if ( s_macDeactivateWindow == this )
         s_macDeactivateWindow = NULL;
 }
 
+bool wxNonOwnedWindow::Destroy()
+{
+    WillBeDestroyed();
+    
+    return wxWindow::Destroy();
+}
+
+void wxNonOwnedWindow::WillBeDestroyed()
+{
+    if ( m_nowpeer )
+        m_nowpeer->WillBeDestroyed();
+}
+
 // ----------------------------------------------------------------------------
 // wxNonOwnedWindow misc
 // ----------------------------------------------------------------------------