Re: GVolumeMonitor, signals and scoping

On Tue, 2012-09-25 at 09:54 -0600, Daniel Drake wrote:

> I guess the above behaviour makes sense, but it touches upon something
> I've never been quite certain about: if a gobject (or some kind of Gtk
> object) has all its references dropped but there are still signal
> handlers connected, does gobject/gtk go ahead and destroy the object
> anyway?

The way to think of this is that signals don't add strong refs.

And as a general rule, I think you should structure your
application/scripts to have a global "app" object (using GApplication,
or it could just be a python dict or something), and hook everything
else off that.

The one special case unfortunately is GtkWindow - GTK itself holds
strong refs to all windows unless they're explicitly destroyed.  That
special case unfortunately confuses a lot of people and muddles
the conceptual clarity of the system.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]