[PyKDE] qactions not destroyed after qmenu menu closes

Matt Chambers chambers at imageworks.com
Wed Nov 15 19:28:19 GMT 2006


Andreas Pakulat wrote:
> On 14.11.06 13:42:29, Matt Chambers wrote:
>   
>> I'm dynamically creating a context menu for a QTableView, populated with some 
>> QActions.  Everytime
>> I right click, the menu is created.  Over time, hundreds of these closed menus 
>> will set in memory, along
>> with all the qactions, assoctated icons and text, ect.  When I close the app, I 
>> see all of them destroyed.
>>
>> Is there a way to have a qmenu clean up after itself after it closes?
>>     
>
> Sure, remove all references to it and the python garbage collector will
> delete it. This means that you shouldn't set the menu as a member of
> your QTableView subclass but only create it inside the context-menu
> function as a local instance.
>
> Andreas
>
>   
Maybe I was doing it wrong.  I was running menu.popup(). When I switched 
the menu.exec_() everything
was garbaged collected properly.  I didn't make any other changes.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20061115/d937151d/attachment.html


More information about the PyQt mailing list