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.