Hi all, I'm working on a (Python) program which, in short, is a threaded TCP socket server which creates a new "tab" in a wx.Notebook widget for every incoming connection it sees. I've run into a strange problem where when I call notebook.AddPage(...), one of three things happens:
- A "tab" correctly appears for the new page
- No new "tab" appears, even though if I call GetPageCount() on the notebook, it returns the correct value
- I receive the following error: "*** glibc detected *** python: double free or corruption (fasttop): 0x000000000164dbe0 ****" followed by a very long backtrace with a cryptic memory map.
Since it would be inconsiderate to post all of my code here, I wrote a little script (based on something I found online) which also exhibits this behavior (although it works correctly most of the time).
import wx
from wx.lib.pubsub import Publisher
import thread
import time
# Some classes to use for the notebook pages. Obviously you would
# want to use something more meaningful for your application, these
# are just for illustration.
class PageOne(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
t = wx.StaticText(self, -1, "This is a PageOne object", (20,20))
class PageTwo(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
t = wx.StaticText(self, -1, "This is a PageTwo object", (40,40))
class PageThree(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
t = wx.StaticText(self, -1, "This is a PageThree object", (60,60))
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Simple Notebook Example", size=(600, 500))
Publisher.subscribe(self.NewPage, "add.page")
# Here we create a panel and a …