Clean up signal handlers in animation actor and remote texture
authorArtem Egorkine <ext-artem.egorkine@nokia.com>
Wed, 13 May 2009 14:58:32 +0000 (17:58 +0300)
committerClaudio Saavedra <csaavedra@igalia.com>
Wed, 13 May 2009 14:58:32 +0000 (17:58 +0300)
* src/hildon-animation-actor.c,
* src/hildon-remote-texture.c:
Added proper object cleanup to remove signal handler and object
references as HildonAnimationActor and HildonRemoteTexture
objects get destroyed.

Fixes: NB#116682 (Destroying parented animation actors when
parent in unmapped leads to crash)

ChangeLog
hildon/hildon-animation-actor.c
hildon/hildon-remote-texture.c

index 3be621d..8dec0af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-13  Artem Egorkine  <ext-artem.egorkine@nokia.com>
+
+       * src/hildon-animation-actor.c,
+       * src/hildon-remote-texture.c:
+       Added proper object cleanup to remove signal handler and object
+       references as HildonAnimationActor and HildonRemoteTexture
+       objects get destroyed.
+
+       Fixes: NB#116682 (Destroying parented animation actors when
+       parent in unmapped leads to crash)
+
 2009-05-13  Claudio Saavedra  <csaavedra@igalia.com>
 
        Based on a patch by Christian Dywan (christian@imendio.com)
index 0d623d8..b826ffb 100644 (file)
@@ -277,10 +277,30 @@ hildon_animation_actor_hide                    (GtkWidget *widget)
 }
 
 static void
+hildon_animation_actor_finalize                (GObject *object)
+{
+    HildonAnimationActor        *self = HILDON_ANIMATION_ACTOR (object);
+    HildonAnimationActorPrivate
+                      *priv = HILDON_ANIMATION_ACTOR_GET_PRIVATE (self);
+
+    if (priv->parent)
+    {
+       if (priv->parent_map_event_cb_id)
+           g_signal_handler_disconnect (priv->parent,
+                                        priv->parent_map_event_cb_id);
+
+       g_object_unref (priv->parent);
+    }
+}
+
+static void
 hildon_animation_actor_class_init              (HildonAnimationActorClass *klass)
 {
+    GObjectClass      *gobject_class = G_OBJECT_CLASS (klass);
     GtkWidgetClass    *widget_class = GTK_WIDGET_CLASS (klass);
 
+    gobject_class->finalize         = hildon_animation_actor_finalize;
+
     widget_class->realize           = hildon_animation_actor_realize;
     widget_class->unrealize         = hildon_animation_actor_unrealize;
     widget_class->show              = hildon_animation_actor_show;
index f8bbbd7..8440158 100644 (file)
@@ -169,10 +169,30 @@ hildon_remote_texture_hide                    (GtkWidget *widget)
 }
 
 static void
+hildon_remote_texture_finalize                (GObject *object)
+{
+    HildonRemoteTexture        *self = HILDON_REMOTE_TEXTURE (object);
+    HildonRemoteTexturePrivate
+                       *priv = HILDON_REMOTE_TEXTURE_GET_PRIVATE (self);
+
+    if (priv->parent)
+    {
+        if (priv->parent_map_event_cb_id)
+            g_signal_handler_disconnect (priv->parent,
+                                         priv->parent_map_event_cb_id);
+
+        g_object_unref (priv->parent);
+    }
+}
+
+static void
 hildon_remote_texture_class_init              (HildonRemoteTextureClass *klass)
 {
+    GObjectClass      *gobject_class = G_OBJECT_CLASS (klass);
     GtkWidgetClass    *widget_class = GTK_WIDGET_CLASS (klass);
 
+    gobject_class->finalize         = hildon_remote_texture_finalize;
+
     widget_class->realize           = hildon_remote_texture_realize;
     widget_class->unrealize         = hildon_remote_texture_unrealize;
     widget_class->show              = hildon_remote_texture_show;