Blame SOURCES/0001-clutter-clone-Unset-source-when-source-actor-is-dest.patch

67f8b7
From 82eb06def0b02efec2852aced4f0e609abb12557 Mon Sep 17 00:00:00 2001
67f8b7
From: Rui Matos <tiagomatos@gmail.com>
67f8b7
Date: Thu, 2 Mar 2017 19:18:43 +0100
67f8b7
Subject: [PATCH] clutter-clone: Unset source when source actor is destroyed
67f8b7
67f8b7
Otherwise we might be holding on to a source actor that's no longer
67f8b7
fully functioning and cause crashes if for example we try to paint it.
67f8b7
67f8b7
https://bugzilla.gnome.org/show_bug.cgi?id=779483
67f8b7
---
67f8b7
 clutter/clutter/clutter-clone.c | 12 ++++++++++++
67f8b7
 1 file changed, 12 insertions(+)
67f8b7
67f8b7
diff --git a/clutter/clutter/clutter-clone.c b/clutter/clutter/clutter-clone.c
67f8b7
index af03a4e81..f0eea2459 100644
67f8b7
--- a/clutter/clutter/clutter-clone.c
67f8b7
+++ b/clutter/clutter/clutter-clone.c
67f8b7
@@ -54,6 +54,7 @@
67f8b7
 struct _ClutterClonePrivate
67f8b7
 {
67f8b7
   ClutterActor *clone_source;
67f8b7
+  gulong source_destroy_id;
67f8b7
 };
67f8b7
 
67f8b7
 G_DEFINE_TYPE_WITH_PRIVATE (ClutterClone, clutter_clone, CLUTTER_TYPE_ACTOR)
67f8b7
@@ -377,6 +378,13 @@ clutter_clone_new (ClutterActor *source)
67f8b7
 }
67f8b7
 
67f8b7
 static void
67f8b7
+on_source_destroyed (ClutterActor *source,
67f8b7
+                     ClutterClone *self)
67f8b7
+{
67f8b7
+  clutter_clone_set_source_internal (self, NULL);
67f8b7
+}
67f8b7
+
67f8b7
+static void
67f8b7
 clutter_clone_set_source_internal (ClutterClone *self,
67f8b7
 				   ClutterActor *source)
67f8b7
 {
67f8b7
@@ -387,6 +395,8 @@ clutter_clone_set_source_internal (ClutterClone *self,
67f8b7
 
67f8b7
   if (priv->clone_source != NULL)
67f8b7
     {
67f8b7
+      g_signal_handler_disconnect (priv->clone_source, priv->source_destroy_id);
67f8b7
+      priv->source_destroy_id = 0;
67f8b7
       _clutter_actor_detach_clone (priv->clone_source, CLUTTER_ACTOR (self));
67f8b7
       g_object_unref (priv->clone_source);
67f8b7
       priv->clone_source = NULL;
67f8b7
@@ -396,6 +406,8 @@ clutter_clone_set_source_internal (ClutterClone *self,
67f8b7
     {
67f8b7
       priv->clone_source = g_object_ref (source);
67f8b7
       _clutter_actor_attach_clone (priv->clone_source, CLUTTER_ACTOR (self));
67f8b7
+      priv->source_destroy_id = g_signal_connect (priv->clone_source, "destroy",
67f8b7
+                                                  G_CALLBACK (on_source_destroyed), self);
67f8b7
     }
67f8b7
 
67f8b7
   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SOURCE]);
67f8b7
-- 
67f8b7
2.13.0
67f8b7