Re: removing signal handler when finalizing a gobject instance.



On Wed, 15 Dec 2004, Matthias Clasen wrote:

On Wed, 2004-12-15 at 15:01 +0100, Michael Natterer wrote:
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.

But notice that
http://bugzilla.gnome.org/show_bug.cgi?id=118536
has not been fixed yet. Tim, any hope for a patch review on that ?

yes, either during the holidays or otherwise in late february since university
is keeping me quite busy atm.


Matthias


---
ciaoTJ



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