constraints: Remove signal handlers on dispose

Same as commit 2fa8b3a3ab but done for
AlignConstraint and SnapConstraint as well.
This commit is contained in:
Emmanuele Bassi 2010-12-18 13:24:54 +00:00
parent 2fa8b3a3ab
commit 491bbc226e
3 changed files with 46 additions and 11 deletions

View File

@ -152,6 +152,25 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint,
}
}
static void
clutter_align_constraint_dispose (GObject *gobject)
{
ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (gobject);
if (align->source != NULL)
{
g_signal_handlers_disconnect_by_func (align->source,
G_CALLBACK (source_destroyed),
align);
g_signal_handlers_disconnect_by_func (align->source,
G_CALLBACK (source_position_changed),
align);
align->source = NULL;
}
G_OBJECT_CLASS (clutter_align_constraint_parent_class)->dispose (gobject);
}
static void
clutter_align_constraint_set_property (GObject *gobject,
guint prop_id,
@ -268,11 +287,10 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
0.0,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
gobject_class->dispose = clutter_align_constraint_dispose;
gobject_class->set_property = clutter_align_constraint_set_property;
gobject_class->get_property = clutter_align_constraint_get_property;
_clutter_object_class_install_properties (gobject_class,
PROP_LAST,
obj_props);
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
}
static void

View File

@ -213,10 +213,10 @@ clutter_bind_constraint_dispose (GObject *gobject)
if (bind->source != NULL)
{
g_signal_handlers_disconnect_by_func (bind->source,
source_destroyed,
G_CALLBACK (source_destroyed),
bind);
g_signal_handlers_disconnect_by_func (bind->source,
source_queue_relayout,
G_CALLBACK (source_queue_relayout),
bind);
bind->source = NULL;
}

View File

@ -214,6 +214,25 @@ clutter_snap_constraint_set_actor (ClutterActorMeta *meta,
parent->set_actor (meta, new_actor);
}
static void
clutter_snap_constraint_dispose (GObject *gobject)
{
ClutterSnapConstraint *snap = CLUTTER_SNAP_CONSTRAINT (gobject);
if (snap->source != NULL)
{
g_signal_handlers_disconnect_by_func (snap->source,
G_CALLBACK (source_destroyed),
snap);
g_signal_handlers_disconnect_by_func (snap->source,
G_CALLBACK (source_queue_relayout),
snap);
snap->source = NULL;
}
G_OBJECT_CLASS (clutter_snap_constraint_parent_class)->dispose (gobject);
}
static void
clutter_snap_constraint_set_property (GObject *gobject,
guint prop_id,
@ -289,9 +308,6 @@ clutter_snap_constraint_class_init (ClutterSnapConstraintClass *klass)
ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = clutter_snap_constraint_set_property;
gobject_class->get_property = clutter_snap_constraint_get_property;
meta_class->set_actor = clutter_snap_constraint_set_actor;
constraint_class->update_allocation = clutter_snap_constraint_update_allocation;
@ -355,9 +371,10 @@ clutter_snap_constraint_class_init (ClutterSnapConstraintClass *klass)
0.0f,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
_clutter_object_class_install_properties (gobject_class,
PROP_LAST,
obj_props);
gobject_class->dispose = clutter_snap_constraint_dispose;
gobject_class->set_property = clutter_snap_constraint_set_property;
gobject_class->get_property = clutter_snap_constraint_get_property;
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
}
static void