From: Benny M. <ben...@gm...> - 2009-02-20 09:00:18
|
Gary, I wonder if there is no possibility to actually use the __del__ method? http://docs.python.org/reference/datamodel.html#special-method-names. So __del__ is called when ref count is zero, and del x decreases the ref count. As the editors and tabs are destroyed and have ref count of one, on destruction __del__ would be called, and there the del of the gtk objects can be done. If this works the difference would be that no cleanup_on_exit method must be called in the using objects, as python takes care of calling __del__ on the tabs when ref count goes to zero. Don't know if it would work though, as GrampsTab inherits from VBox and is part of the glade notebook. I wonder how you make sure the tab itself obtains a del, in the editors I suppose? If so, then doing del on them, would invoke __del__ but only if glade does not interfere with a ref count of itself. See also: http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaksabout circular links causing memory leaks Benny 2009/2/19 Gary Burton <bur...@ya...> > >I will try this on one of the editor windows tomorrow night and see if it > fixes the leaks. > > I have experimented further with the event editor window and it is showing > some promise. > > For this particular window all the non-glade GTK objects are concentrated > in the various tab page objects. In my own repository I have added a cleanup > method to each tab object as well as their ancestor objects GrampsTab, > ButtonTab and EmbeddedList where I can del any instance variables pointing > to GTK objects. Instance variables containing lists of these objects also > need removing from scope. > > Any window based on EditPrimary has a cleanup_on_exit method where each tab > cleanup method can be called followed by a del on the instance variables > referencing each tab. > > Doing all of this gives me an event editor window that closes down cleanly > without leaving behind any of it's little friends. I don't have any more > time to work on Gramps till the weekend, so I shall commit some changes to > SVN then, but it's looking good so far. > > Bye > > Gary > > > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Gramps-devel mailing list > Gra...@li... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > > |