]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/auibook.cpp
supporting -1 as 'to' parameter for selections
[wxWidgets.git] / src / aui / auibook.cpp
index f387d6ed67654c7b1cd77174075863f272b5ba70..289faccafaa20ade519b7f6b1ae9a6688ce8dbc4 100644 (file)
@@ -2865,6 +2865,9 @@ void wxAuiNotebook::InitNotebook(long style)
 
 wxAuiNotebook::~wxAuiNotebook()
 {
+    // Indicate we're deleting pages
+    m_isBeingDeleted = true;
+
     while ( GetPageCount() > 0 )
         DeletePage(0);
 
@@ -3061,6 +3064,10 @@ bool wxAuiNotebook::InsertPage(size_t page_idx,
                                bool select,
                                const wxBitmap& bitmap)
 {
+    wxASSERT_MSG(page, wxT("page pointer must be non-NULL"));
+    if (!page)
+        return false;
+    
     page->Reparent(this);
 
     wxAuiNotebookPage info;
@@ -3225,7 +3232,7 @@ bool wxAuiNotebook::RemovePage(size_t page_idx)
     RemoveEmptyTabFrames();
 
     // set new active pane
-    if (new_active)
+    if (new_active && !m_isBeingDeleted)
     {
         m_curpage = -1;
         SetSelectionToWindow(new_active);
@@ -4104,7 +4111,8 @@ void wxAuiNotebook::RemoveEmptyTabFrames()
         m_mgr.GetPane(first_good).Centre();
     }
 
-    m_mgr.Update();
+    if (!m_isBeingDeleted)
+        m_mgr.Update();
 }
 
 void wxAuiNotebook::OnChildFocusNotebook(wxChildFocusEvent& evt)