[PyQt] memory leak using QMainWindow.removeToolBar

Phil Thompson phil at riverbankcomputing.com
Tue Aug 17 08:35:33 BST 2010


On Mon, 16 Aug 2010 22:59:22 +0000 (UTC), danny <shevitz at lanl.gov> wrote:
> thanks,
> 
> your solution works, and stops my code from seg faulting. I'm curious
> why mine doesn't work. In the documentation for QMainWindow
> 
>
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qmainwindow.html#addToolBar-3
> 
> The third overloading of the addToolBar method, was what I was using.
> 
> It should be equivalent, but I must be missing something.

There does seem to be a bug. Even though addToolBar() takes ownership of
the toolbar, removeToolBar() doesn't change the current ownership.

It will be fixed in tonight's snapshot. The consequence is that you have
to do extra work to really delete a removed toolbar, ie. reparent it to
None.

Phil


More information about the PyQt mailing list