[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 927
Date       : Tue May  2 11:03:56 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxXtra/manager.cpp

Two fixes to wxAUI consequent upon the change to window deletion order


Diff:
Index: Trunk/XaraLX/wxXtra/manager.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/manager.cpp	(revision 926)
+++ Trunk/XaraLX/wxXtra/manager.cpp	(revision 927)
@@ -685,8 +685,13 @@
             // we should really return here without doing anything if the close was vetoed
         }
 
-        m_owner_mgr->OnFloatingPaneClosed(m_pane_window);
-        Destroy();
+        // The problem here is that the above can cause the window itself to be destroyed
+        if (!IsBeingDeleted() && m_pane_window && !m_pane_window->IsBeingDeleted()
+            && (m_pane_window->GetParent()==this))
+        {
+            m_owner_mgr->OnFloatingPaneClosed(m_pane_window);
+            Destroy();
+        }
     }
 
     void OnMoveEvent(wxMoveEvent& event)
@@ -4313,8 +4318,20 @@
     
     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)
     {


Xara