On Wed, 10 Oct 2001, Matt Wilson wrote: > On Wed, Oct 10, 2001 at 04:50:12PM +0200, Peter Kese wrote: > > > > Presumably when label is deleted, its __del__ method should get called. > > But it doesn't. When and how should I use unref(), sink() and other > > methods? > > > > How and when do PyGtk objects ever get deleted. > > Here's the trick. This python object doesn't get deallocated until > the GObject inside gets deallocated too. When you remove a python > object from your local scope (with del), and the GObject still has a > refcount, or is floating (I think -- may be this shouldn't be the case > - we had bugs there in old pygtk), the dealloc function will store a > pointer to the instance of the python object _inside_ the GObject. > This keeps the python object alive and is required to keep the one > python object <-> one GObject mapping that PyGTK 2.0 is using. > > Now, your case puzzles me. I think that there may be some problems > with extended types and __del__? Does __del__ chain properly? Or do > we need code to do that in our pygobject before we tear down the whole > object? PEP 252 isn't clear...
I don't know if overriding __del__ is supported for new style types yet. James. -- Email: [EMAIL PROTECTED] WWW: http://www.daa.com.au/~james/ _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
