From 491bbc226ee52546507406714030a9647dde4280 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sat, 18 Dec 2010 13:24:54 +0000 Subject: [PATCH] constraints: Remove signal handlers on dispose Same as commit 2fa8b3a3abc7bb8e96a85d927edc0594f44f55df but done for AlignConstraint and SnapConstraint as well. --- clutter/clutter-align-constraint.c | 24 +++++++++++++++++++++--- clutter/clutter-bind-constraint.c | 4 ++-- clutter/clutter-snap-constraint.c | 29 +++++++++++++++++++++++------ 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/clutter/clutter-align-constraint.c b/clutter/clutter-align-constraint.c index 25bcfc842..a429df912 100644 --- a/clutter/clutter-align-constraint.c +++ b/clutter/clutter-align-constraint.c @@ -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 diff --git a/clutter/clutter-bind-constraint.c b/clutter/clutter-bind-constraint.c index 5e64e7efe..a655fb95e 100644 --- a/clutter/clutter-bind-constraint.c +++ b/clutter/clutter-bind-constraint.c @@ -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; } diff --git a/clutter/clutter-snap-constraint.c b/clutter/clutter-snap-constraint.c index af630fdfe..7384574d2 100644 --- a/clutter/clutter-snap-constraint.c +++ b/clutter/clutter-snap-constraint.c @@ -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