Blame SOURCES/atk-use-after-free.patch

0dff19
diff -up atk-2.22.0/atk/atkgobjectaccessible.c.use-after-free atk-2.22.0/atk/atkgobjectaccessible.c
0dff19
--- atk-2.22.0/atk/atkgobjectaccessible.c.use-after-free	2016-09-19 15:26:16.000000000 +0200
0dff19
+++ atk-2.22.0/atk/atkgobjectaccessible.c	2017-05-22 19:31:40.538875766 +0200
0dff19
@@ -37,7 +37,7 @@
0dff19
 static void       atk_gobject_accessible_class_init       (AtkGObjectAccessibleClass   *klass);
0dff19
 static void       atk_real_gobject_accessible_initialize  (AtkObject         *atk_obj,
0dff19
                                                            gpointer          data);
0dff19
-static void       atk_gobject_accessible_dispose          (gpointer          data);
0dff19
+static void       atk_gobject_accessible_object_gone_cb   (gpointer          data);
0dff19
 
0dff19
 static GQuark quark_accessible_object = 0;
0dff19
 static GQuark quark_object = 0;
0dff19
@@ -88,8 +88,7 @@ atk_gobject_accessible_for_object (GObje
0dff19
   g_return_val_if_fail (G_IS_OBJECT (obj), NULL);
0dff19
   /* See if we have a cached accessible for this object */
0dff19
 
0dff19
-  accessible = g_object_get_qdata (obj,
0dff19
-				   quark_accessible_object);
0dff19
+  accessible = quark_accessible_object ? g_object_get_qdata (obj, quark_accessible_object) : NULL;
0dff19
 
0dff19
   if (!accessible)
0dff19
     {
0dff19
@@ -146,12 +145,12 @@ atk_real_gobject_accessible_initialize (
0dff19
   atk_obj->layer = ATK_LAYER_WIDGET;
0dff19
 
0dff19
   g_object_weak_ref (data,
0dff19
-                     (GWeakNotify) atk_gobject_accessible_dispose,
0dff19
+                     (GWeakNotify) atk_gobject_accessible_object_gone_cb,
0dff19
                      atk_gobj);
0dff19
 }
0dff19
 
0dff19
 static void
0dff19
-atk_gobject_accessible_dispose (gpointer  data)
0dff19
+atk_gobject_accessible_object_gone_cb (gpointer  data)
0dff19
 {
0dff19
   GObject *object;
0dff19
 
0dff19
@@ -168,9 +167,29 @@ atk_gobject_accessible_dispose (gpointer
0dff19
 }
0dff19
 
0dff19
 static void
0dff19
+atk_gobject_accessible_dispose (GObject *atk_obj)
0dff19
+{
0dff19
+   GObject *obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (atk_obj));
0dff19
+
0dff19
+   if (obj) {
0dff19
+      g_object_set_qdata (obj, quark_accessible_object, NULL);
0dff19
+      g_object_weak_unref (obj,
0dff19
+                           (GWeakNotify) atk_gobject_accessible_object_gone_cb,
0dff19
+                           atk_obj);
0dff19
+
0dff19
+      g_object_set_qdata (atk_obj, quark_object, NULL);
0dff19
+      atk_object_notify_state_change (ATK_OBJECT (atk_obj), ATK_STATE_DEFUNCT,
0dff19
+                                      TRUE); 
0dff19
+   }
0dff19
+
0dff19
+   G_OBJECT_CLASS (parent_class)->dispose (atk_obj);
0dff19
+}
0dff19
+
0dff19
+static void
0dff19
 atk_gobject_accessible_class_init (AtkGObjectAccessibleClass *klass)
0dff19
 { 
0dff19
   AtkObjectClass *class;
0dff19
+  GObjectClass *object_class;
0dff19
 
0dff19
   class = ATK_OBJECT_CLASS (klass);
0dff19
 
0dff19
@@ -178,6 +197,9 @@ atk_gobject_accessible_class_init (AtkGO
0dff19
 
0dff19
   class->initialize = atk_real_gobject_accessible_initialize;
0dff19
 
0dff19
+  object_class = G_OBJECT_CLASS (klass);
0dff19
+  object_class->dispose = atk_gobject_accessible_dispose;
0dff19
+
0dff19
   if (!quark_accessible_object)
0dff19
     quark_accessible_object = g_quark_from_static_string ("accessible-object");
0dff19
   quark_object = g_quark_from_static_string ("object-for-accessible");