I haven't yet reduced the problem to a short reproducible test case,
but I'm hoping an expert can spot an obvious mistake. I'm on linux,
using wxPython 2.8.11.0
I have an application that seems to run just fine with several AUI
panels. When I try to add a toolbar my app always segfaults on exit.
Here's the code I'm using:
import wx.aui as aui
...
# "self" inherits from wx.Frame,
toolbar = aui.AuiToolBar(self, wx.ID_ANY)
toolbar.AddTool(wx.ID_ANY, "Test", getPlayImageBitmap())
toolbar.Realize()
self.toolbar = toolbar # save a reference or I get a segv on startup
self.auimgr.AddPane(toolbar, wx.aui.AuiPaneInfo().
ToolbarPane().
Top().
Name("Toolbar"))
self.auimgr.GetPane(toolbar).Show()
Without that code my app runs fine. With that code I get a segv every
time I exit. What am I doing wrong?
Probably something is getting destroyed twice, and from your self.toolbar line above I would guess that it is the toolbar itself.
Have you tried using wx.lib.agw.aui instead?
···
On 11/26/10 5:19 PM, Bryan Oakley wrote:
I haven't yet reduced the problem to a short reproducible test case,
but I'm hoping an expert can spot an obvious mistake. I'm on linux,
using wxPython 2.8.11.0
I have an application that seems to run just fine with several AUI
panels. When I try to add a toolbar my app always segfaults on exit.
Here's the code I'm using:
import wx.aui as aui
...
# "self" inherits from wx.Frame,
toolbar = aui.AuiToolBar(self, wx.ID_ANY)
toolbar.AddTool(wx.ID_ANY, "Test", getPlayImageBitmap())
toolbar.Realize()
self.toolbar = toolbar # save a reference or I get a segv on startup
self.auimgr.AddPane(toolbar, wx.aui.AuiPaneInfo().
ToolbarPane().
Top().
Name("Toolbar"))
self.auimgr.GetPane(toolbar).Show()
Without that code my app runs fine. With that code I get a segv every
time I exit. What am I doing wrong?
Yes, I switched to wx.lib.agw.aui and the problem goes away. If
something is getting destroyed twice it's certainly not on purpose. I
don't directly destroy anything, I leave that up to the default
destructors.
This makes me curious: why are there two aui libraries and which one
is "best"? For the moment wx.lib.agw.aui is best for me because it
doesn't segfault but the performance seems slower, which makes sense
since it's pure python, right?
As someone who isn't fully embedded in the wxWorld and haven't
followed its evolution over the past few years, I find the wx.aui /
wx.lib.agw.aui situation vexing.
···
On Sat, Nov 27, 2010 at 2:37 PM, Robin Dunn <robin@alldunn.com> wrote:
Probably something is getting destroyed twice, and from your self.toolbar
line above I would guess that it is the toolbar itself.
Probably something is getting destroyed twice, and from your self.toolbar
line above I would guess that it is the toolbar itself.
Have you tried using wx.lib.agw.aui instead?
Yes, I switched to wx.lib.agw.aui and the problem goes away. If
something is getting destroyed twice it's certainly not on purpose. I
don't directly destroy anything, I leave that up to the default
destructors.
This is because wx.aui has a decade-old bug related to toolbars opened
on wxTrac which has never been fixed.
This makes me curious: why are there two aui libraries and which one
is "best"? For the moment wx.lib.agw.aui is best for me because it
doesn't segfault but the performance seems slower, which makes sense
since it's pure python, right?
Possibly, but "slower" is relative. Which platform are you on?
wxPython version? Have you tried the SVN version of wx.lib.agw.aui?
How complex is you layout?
As someone who isn't fully embedded in the wxWorld and haven't
followed its evolution over the past few years, I find the wx.aui /
wx.lib.agw.aui situation vexing.
As wx.aui seemed more or less unmaintained at that time (and it still
is), I decided to rewrite it in pure Python to be able to fix existing
bugs and adding more features. There isn't such a thing as "the best
one of the two". wx.lib.agw.aui has a lot more features, most of the
bugs present in wx.aui have been fixed and I am the current maintainer
of it (although I have been a bit absent in the past couple of
months), so you might expect a bit more responsiveness when you submit
a bug (possibly with a patch) on wxTrac. Other than that, both
libraries do pretty much the same job: if you need more flexibility,
or more options, or more maintainance, my (biased) suggestion would be
to stick with wx.lib.agw.aui.
Probably something is getting destroyed twice, and from your self.toolbar
line above I would guess that it is the toolbar itself.
Have you tried using wx.lib.agw.aui instead?
Yes, I switched to wx.lib.agw.aui and the problem goes away. If
something is getting destroyed twice it's certainly not on purpose. I
don't directly destroy anything, I leave that up to the default
destructors.
This is because wx.aui has a decade-old bug related to toolbars opened
on wxTrac which has never been fixed.
Really? That's amazing. What, does nobody write apps with toolbars these days?
This makes me curious: why are there two aui libraries and which one
is "best"? For the moment wx.lib.agw.aui is best for me because it
doesn't segfault but the performance seems slower, which makes sense
since it's pure python, right?
Possibly, but "slower" is relative. Which platform are you on?
wxPython version? Have you tried the SVN version of wx.lib.agw.aui?
How complex is you layout?
Platforms? All of 'em (win, mac, linux). The performance I noticed was
on a linux box I was accessing via vpn from a mac using nxclient,
which might have something to do with it. No, haven't used svn version
and don't plan too. That's a bit too bleeding edge. Plus, I need to
support the software my corporate users already have. In many cases my
users don't have root access and can only install what's on company
repositories.
How complex is my layout? Not very. A main area, a tree on the left, a
couple of list controls on the right, a notebook at the bottom with
three our four tabs. Plus a toolbar.
Thanks for the description of wx.aui versus wx.lib.agw.aui, it helps.
There's a lot to like about aui, and if you've recreated the whole
thing in python, that's impressive.
Again, thanks.
--bryan
···
On Sat, Nov 27, 2010 at 3:54 PM, Andrea Gavana <andrea.gavana@gmail.com> wrote:
On 27 November 2010 23:41, Bryan Oakley wrote:
On Sat, Nov 27, 2010 at 2:37 PM, Robin Dunn <robin@alldunn.com> wrote: