Re: wxNotebook and DeleteAllPages()

PyMapper Developer <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
Okay, that makes sense.   So, in changing the code to add three new panels 
instead
 
     nbPanel1 = wx.Window(self.testNotebook) 
     nbPanel2 = wx.Window(self.testNotebook) 
     nbPanel3= wx.Window(self.testNotebook) 
     self.testNotebook.AddPage(nbPanel1, "test1") 
     self.testNotebook.AddPage(nbPanel2, "test2") 
     self.testNotebook.AddPage(nbPanel3, "test3") 

I end up with this error instead once I try to do the DeleteAllPages()

wx._core.wxAssertionError: C++ assertion "(int)m_pages.Count() == 
(int)::SendMessageW((((HWND)GetHWND())), (0x1300 + 4), 0, 0L)" failed at 
..\..\src\msw\notebook.cpp(343) in wxNotebook::GetPageCount():

Visually, I see the Notebook in the frame get the new page right before it 
crashes.

> 
> >     self.testNotebook = wx.Notebook(self) 
> >     nbPanel1 = wx.Window(self.testNotebook) 
> >     nbPanel2 = wx.Window(self.testNotebook) 
> >     nbPanel3= wx.Window(self.testNotebook) 
> >     self.testNotebook.AddPage(nbPanel1, "test1") 
> >     self.testNotebook.AddPage(nbPanel2, "test2") 
> >     self.testNotebook.AddPage(nbPanel3, "test3") 
>
> This is the problem. You are adding the same page window as 3 different 
> notebook pages. When you do DeleteAllPages then it is trying to destroy 
> the window 3 times, which will cause invalid and possibly garbage memory 
> to be accessed the 2nd and 3rd times. 
>
> -- 
> Robin Dunn 
> Software Craftsman 
> http://wxPython.org 
>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.