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.


_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to