You can’t create a Listbook without giving it a parent. When I execute that code, it crashes before the DeleteAllPages() call. When you say that “even this small buggy app” crashes, it’s because the app neglects several things that it fails to DeleteAllPages().
Are you sure that you create Listbooks properly? You need to give the Listbook a parent, such as a wx.Dialog or a wx.Frame, before you can create the Listbook.
My guess is that you get the segmentation fault because you don’t create the Listbooks properly, then you try to operate on them.
#If you comment this line, the application works ! #If not ---> Segmentation Fault. Why???
myListbook.DeleteAllPages()
There is a bug that doesn't reset the current page index when the pages are deleted, so the next time it tries to access the current page from the empty array it crashes. It's already been fixed in 2.7, I'll see if it can be backported to 2.6.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
But, if this is a bug, can you tell me the best way to populate and depopulate a Listbook programmaticaly??
···
On Mon, 14 Aug 2006 10:19:00 -0700 Robin Dunn <robin@alldunn.com> wrote:
There is a bug that doesn't reset the current page index when the pages
are deleted, so the next time it tries to access the current page from
the empty array it crashes. It's already been fixed in 2.7, I'll see if
it can be backported to 2.6.
On Mon, 14 Aug 2006 10:19:00 -0700 > Robin Dunn <robin@alldunn.com> wrote:
There is a bug that doesn't reset the current page index when the pages are deleted, so the next time it tries to access the current page from the empty array it crashes. It's already been fixed in 2.7, I'll see if it can be backported to 2.6.
It would be great. Thanks Robin.
But, if this is a bug, can you tell me the best way to populate and depopulate a Listbook programmaticaly??
The problem happens when the first size event after DeleteAllPages has been called tries to access the array of pages with a bad index. So if after you delete all the pages if you add one, and be sure that it is the selected one, then it should be ok.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!