[pygtk] destructors not getting called

N. French nbm_clan at yahoo.com
Tue Aug 8 08:06:44 WST 2006


Maybe I'm not understanding that paragraph, but I'm saying that even in
the event of program termination I have objects that aren't getting
finalized properly.  I don't think that is what that is talking about
(but I certainly appreciate the suggestion).

--- Wildemar Wildenburger <wildemar at freakmail.de> wrote:

> N. French wrote:
> > 1.  The App class does not have __del__ called unless I explicitly
> call
> > it in my window destroy callback.
> > 
> > 2.  The container classes don't have __del__ called unless I
> explicitly
> > call it (from my App's destructor).
> > 
> > I tested the container classes separately and the destructors get
> > called just like you'd expect, which is why I'm thinking this has
> > something to do with GTK.  Below is my startup code.
> 
> I found this in the reference recently, maybe its related:
> 
> *quote from the description of gtk.Object*
> The "destroy" signal, emitted by the destroy() method asks all code 
> owning a GTK reference to the object to release its GTK reference.
> So, 
> for example, if you call window.destroy() where window is a
> gtk.Window, 
> GTK will release the GTK reference count that it owns; if you call 
> button.destroy() where button is a gtk.Button, button will be removed
> 
> from its parent container and the parent container will release its
> GTK 
> reference to button. Because these GTK references are released,
> calling 
> destroy() should result in freeing all memory associated with an
> object 
> (finalizing it) if the GTK reference count reaches zero. However, in 
> PyGTK the GTK objects are wrapped in a Python object that has its own
> 
> reference counting mechanism. The destroy() method does not affect
> the 
> Python reference counts. The GTK object associated with a Python
> object 
> will not be released until the Python object reference count reaches 
> zero. Therefore, calling the destroy() method will not result in the 
> finalization of the GTK object until the Python object is finalized.
> In 
> the case mentioned above if a gtk.Button is destroyed using the 
> destroy() method, it will be removed from its container and unmapped
> and 
> unrealized but it will not be finalized because the Python wrapper 
> object will still exist and hold a reference.
> *end quote*
> 
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the pygtk mailing list