destroy event support
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 2 Mar 2003 22:46:44 +0000 (22:46 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 2 Mar 2003 22:46:44 +0000 (22:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19437 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/window.cpp
src/mac/window.cpp

index 4592280816f4752d240f4a567832e3d33fc6ba2b..54df63cb6e6a81f4bbbd9ef31e04ec3e9bf7d437 100644 (file)
@@ -184,10 +184,26 @@ wxWindowMac::~wxWindowMac()
         gFocusWindow = NULL ;
     }
 
+       // CS: copied from MSW :
+    // VS: destroy children first and _then_ detach *this from its parent.
+    //     If we'd do it the other way around, children wouldn't be able
+    //     find their parent frame (see above).
+    DestroyChildren();
+
     if ( m_parent )
         m_parent->RemoveChild(this);
 
-    DestroyChildren();
+    wxWindowDestroyEvent event((wxWindow *)this);
+    (void)GetEventHandler()->ProcessEvent(event);
+
+    // delete our drop target if we've got one
+#if wxUSE_DRAG_AND_DROP
+    if ( m_dropTarget != NULL )
+    {
+        delete m_dropTarget;
+        m_dropTarget = NULL;
+    }
+#endif // wxUSE_DRAG_AND_DROP
 }
 
 // Constructor
index 4592280816f4752d240f4a567832e3d33fc6ba2b..54df63cb6e6a81f4bbbd9ef31e04ec3e9bf7d437 100644 (file)
@@ -184,10 +184,26 @@ wxWindowMac::~wxWindowMac()
         gFocusWindow = NULL ;
     }
 
+       // CS: copied from MSW :
+    // VS: destroy children first and _then_ detach *this from its parent.
+    //     If we'd do it the other way around, children wouldn't be able
+    //     find their parent frame (see above).
+    DestroyChildren();
+
     if ( m_parent )
         m_parent->RemoveChild(this);
 
-    DestroyChildren();
+    wxWindowDestroyEvent event((wxWindow *)this);
+    (void)GetEventHandler()->ProcessEvent(event);
+
+    // delete our drop target if we've got one
+#if wxUSE_DRAG_AND_DROP
+    if ( m_dropTarget != NULL )
+    {
+        delete m_dropTarget;
+        m_dropTarget = NULL;
+    }
+#endif // wxUSE_DRAG_AND_DROP
 }
 
 // Constructor