bind-constraint: Remove handlers in dispose

We should remove the signal handlers on the source actor when a
BindConstraint is disposed, to avoid dangling pointers and wrong
invocations.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2493
This commit is contained in:
Emmanuele Bassi 2010-12-18 13:16:23 +00:00
parent 45c884307e
commit 2fa8b3a3ab

View File

@ -205,6 +205,25 @@ clutter_bind_constraint_set_actor (ClutterActorMeta *meta,
parent->set_actor (meta, new_actor);
}
static void
clutter_bind_constraint_dispose (GObject *gobject)
{
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (gobject);
if (bind->source != NULL)
{
g_signal_handlers_disconnect_by_func (bind->source,
source_destroyed,
bind);
g_signal_handlers_disconnect_by_func (bind->source,
source_queue_relayout,
bind);
bind->source = NULL;
}
G_OBJECT_CLASS (clutter_bind_constraint_parent_class)->dispose (gobject);
}
static void
clutter_bind_constraint_set_property (GObject *gobject,
guint prop_id,
@ -270,6 +289,7 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
gobject_class->set_property = clutter_bind_constraint_set_property;
gobject_class->get_property = clutter_bind_constraint_get_property;
gobject_class->dispose = clutter_bind_constraint_dispose;
meta_class->set_actor = clutter_bind_constraint_set_actor;