Blame SOURCES/0001-cally-Use-a-weak-pointer-to-hold-the-key-focus-in-Ca.patch

2ed9ff
From 19391a9626b087bd4df452e8699d53caa54c350f Mon Sep 17 00:00:00 2001
2ed9ff
From: Emmanuele Bassi <ebassi@gnome.org>
2ed9ff
Date: Mon, 6 May 2013 15:46:25 -0700
2ed9ff
Subject: [PATCH] cally: Use a weak pointer to hold the key focus in CallyStage
2ed9ff
2ed9ff
We want to avoid the pointer getting stale, and causing crashes.
2ed9ff
2ed9ff
https://bugzilla.gnome.org/show_bug.cgi?id=692706
2ed9ff
---
2ed9ff
 clutter/cally/cally-stage.c | 20 ++++++++++++++++++--
2ed9ff
 1 file changed, 18 insertions(+), 2 deletions(-)
2ed9ff
2ed9ff
diff --git a/clutter/cally/cally-stage.c b/clutter/cally/cally-stage.c
2ed9ff
index 2b1cfd1..c95ccb0 100644
2ed9ff
--- a/clutter/cally/cally-stage.c
2ed9ff
+++ b/clutter/cally/cally-stage.c
2ed9ff
@@ -139,7 +139,11 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage,
2ed9ff
       AtkObject *old = NULL;
2ed9ff
 
2ed9ff
       if (self->priv->key_focus != NULL)
2ed9ff
-        old = clutter_actor_get_accessible (self->priv->key_focus);
2ed9ff
+        {
2ed9ff
+          g_object_remove_weak_pointer (G_OBJECT (self->priv->key_focus),
2ed9ff
+                                        (gpointer *) &self->priv->key_focus);
2ed9ff
+          old = clutter_actor_get_accessible (self->priv->key_focus);
2ed9ff
+        }
2ed9ff
       else
2ed9ff
         old = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
2ed9ff
 
2ed9ff
@@ -154,7 +158,19 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage,
2ed9ff
   self->priv->key_focus = key_focus;
2ed9ff
 
2ed9ff
   if (key_focus != NULL)
2ed9ff
-    new = clutter_actor_get_accessible (key_focus);
2ed9ff
+    {
2ed9ff
+      /* ensure that if the key focus goes away, the field inside
2ed9ff
+       * CallyStage is reset. see bug:
2ed9ff
+       *
2ed9ff
+       * https://bugzilla.gnome.org/show_bug.cgi?id=692706
2ed9ff
+       *
2ed9ff
+       * we remove the weak pointer above.
2ed9ff
+       */
2ed9ff
+      g_object_add_weak_pointer (G_OBJECT (self->priv->key_focus),
2ed9ff
+                                 (gpointer *) &self->priv->key_focus);
2ed9ff
+
2ed9ff
+      new = clutter_actor_get_accessible (key_focus);
2ed9ff
+    }
2ed9ff
   else
2ed9ff
     new = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
2ed9ff
 
2ed9ff
-- 
2ed9ff
1.8.1.4
2ed9ff