]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/notebook.cpp
netutils code is MSW-only
[wxWidgets.git] / src / gtk1 / notebook.cpp
index 113739fb5104a6453df28d1eb1b0954830c71b0c..033a14725104a4c037e17a43b1a9880ad4a89d99 100644 (file)
@@ -7,10 +7,13 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "notebook.h"
 #endif
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #include "wx/notebook.h"
 
 #if wxUSE_NOTEBOOK
@@ -240,7 +243,6 @@ void wxNotebook::Init()
     m_inSwitchPage = FALSE;
 
     m_imageList = (wxImageList *) NULL;
-    m_pagesData.DeleteContents( TRUE );
     m_selection = -1;
     m_themeEnabled = TRUE;
 }
@@ -373,7 +375,7 @@ int wxNotebook::SetSelection( int page )
 {
     wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
 
-    wxCHECK_MSG( page < (int)m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
+    wxCHECK_MSG( page >= 0 && page < (int)m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
 
     int selOld = GetSelection();
 
@@ -567,7 +569,9 @@ wxNotebookPage *wxNotebook::DoRemovePage( int page )
 
     gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
 
-    m_pagesData.DeleteObject(GetNotebookPage(page));
+    wxGtkNotebookPage* p = GetNotebookPage(page);
+    m_pagesData.DeleteObject(p);
+    delete p;
 
     return client;
 }