Re: removing signal handler when finalizing a gobject instance.
- From: Michael Natterer <mitch gimp org>
- To: Stefan Kost <kost imn htwk-leipzig de>
- Cc: GTK+ development mailing list <gtk-devel-list gnome org>
- Subject: Re: removing signal handler when finalizing a gobject instance.
- Date: Wed, 15 Dec 2004 15:01:54 +0100
Stefan Kost <kost imn htwk-leipzig de> writes:
> hi hi,
>
> I have an own gobject class. an instance of this class is used somewhere and
> signal handlers are connected to signals, where this instance is passed as
> user_data.
> Am I right that the application developer is responsible for removing the signal
> handlers when the instance that is passed as user_data is disposed.
> Otherwise the signal handler gets called with user_data pointer to invalid mem.
>
> If I understand it right, I just need to find a way to do that ...
The way to do that is using
g_signal_connect_object (instance, "foo-signal",
G_CALLBACK (my_callback),
data_object, 0);
This way the handler is automatically disconnected from "instance"
as soon as "data_object" goes away.
ciao,
--mitch
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]