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

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