]> git.saurik.com Git - wxWidgets.git/commitdiff
prevent some obscure wxAUI crashes after DetachPane() is used (crashes only happen...
authorBenjamin Williams <bwilliams@kirix.com>
Sun, 16 Jul 2006 12:32:51 +0000 (12:32 +0000)
committerBenjamin Williams <bwilliams@kirix.com>
Sun, 16 Jul 2006 12:32:51 +0000 (12:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/aui/framemanager.cpp

index b5cc99fa93cef11c545c2a1a9a4781807470ca79..3079df6dba5fd6170299a7d7461b144e68ae3078 100644 (file)
@@ -764,6 +764,24 @@ bool wxFrameManager::DetachPane(wxWindow* window)
                 p.frame->Destroy();
                 p.frame = NULL;
             }
+            
+            // make sure there are no references to this pane in our uiparts,
+            // just in case the caller doesn't call Update() immediately after
+            // the DetachPane() call.  This prevets obscure crashes which would
+            // happen at window repaint if the caller forgets to call Update()
+            int pi, part_count;
+            for (pi = 0, part_count = (int)m_uiparts.GetCount(); pi < part_count; ++pi)
+            {
+                wxDockUIPart& part = m_uiparts.Item(pi);
+                if (part.pane == &p)
+                {
+                    m_uiparts.RemoveAt(pi);
+                    part_count--;
+                    pi--;
+                    continue;
+                }
+            }
+            
             m_panes.RemoveAt(i);
             return true;
         }