]> git.saurik.com Git - wxWidgets.git/commitdiff
wxAUI: Send a cancel event to the window within a frame which is closed, so it knows...
authorAlex Bligh <alex@alex.org.uk>
Tue, 4 Jul 2006 19:52:22 +0000 (19:52 +0000)
committerAlex Bligh <alex@alex.org.uk>
Tue, 4 Jul 2006 19:52:22 +0000 (19:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39983 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/aui/framemanager.cpp

index d3371527115abb9cfd83266f7d29d83db190e8f8..b44dc0aa263153913202bfb5d322dcb8c8c6b215 100644 (file)
@@ -3486,8 +3486,20 @@ void wxFrameManager::OnPaneButton(wxFrameManagerEvent& event)
 
     if (event.button == wxPaneInfo::buttonClose)
     {
-        pane.Hide();
-        Update();
+        if (pane.IsOk())
+        {
+            wxWindow * pane_window = pane.window;
+            wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
+            cancelEvent.SetEventObject( pane_window );
+            pane_window->GetEventHandler()->ProcessEvent(cancelEvent);
+
+            // The problem here is that the above can cause the window itself to be destroyed
+            if (!pane_window->IsBeingDeleted() && pane.IsOk())
+            {
+                pane.Hide();
+                Update();
+            }
+        }
     }
     else if (event.button == wxPaneInfo::buttonPin)
     {