Re: Object finalization and automatic signals disconnection.



On Wed, Apr 8, 2009 at 4:30 AM, Ali Abdallah <aliov xfce org> wrote:
> Hi,
>
> g_signal_connect //(instance, detailed_signal, c_handler, data), if the
> object which connects to this signal is freed and the instance is not so the
> signal is not automatically disconnected, next signal sent by the instance
> is guaranteed to produce a SIGSEV.
>
> It is very annoying in these cases to disconnect all the signals by hand (by
> id, or name or whatever), unfortunately i didn't find something like
> g_object_disconnect_all ( like in motif for example), and i have read
> somewhere that this is planned for future versions of glib!
>
> Do you know more or less when this is going to happen?
> Do you have a better work-around approach than disconnecting the signals by
> id.

g_signal_connect_object is what you want.
http://library.gnome.org/devel/gobject/stable/gobject-Signals.html#g-signal-connect-object

Unfortunately, http://bugzilla.gnome.org/show_bug.cgi?id=118536 makes
it much less useful than it could be, and my patch to fix it never got
reviewed...


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