Blame SOURCES/0003-clutter-fix-hole-in-ClutterPaintNode.patch

8156c2
From 6d849de8ff486be21ff931bfa63313240b212852 Mon Sep 17 00:00:00 2001
8156c2
From: Christian Hergert <christian@hergert.me>
8156c2
Date: Fri, 21 Feb 2020 22:36:31 +0000
8156c2
Subject: [PATCH 3/3] clutter: fix hole in ClutterPaintNode
8156c2
8156c2
Fixing the missalignment takes the structure from 80 bytes down to 72.
8156c2
8156c2
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1081
8156c2
---
8156c2
 clutter/clutter/clutter-actor.c              |  8 +++----
8156c2
 clutter/clutter/clutter-canvas.c             |  2 +-
8156c2
 clutter/clutter/clutter-image.c              |  2 +-
8156c2
 clutter/clutter/clutter-paint-node-private.h |  6 ++---
8156c2
 clutter/clutter/clutter-paint-node.c         | 23 +++++++++++++++-----
8156c2
 clutter/clutter/clutter-paint-node.h         |  3 +++
8156c2
 6 files changed, 30 insertions(+), 14 deletions(-)
8156c2
8156c2
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
8156c2
index 8da53d3f1..995de8c35 100644
8156c2
--- a/clutter/clutter/clutter-actor.c
8156c2
+++ b/clutter/clutter/clutter-actor.c
8156c2
@@ -3692,7 +3692,7 @@ clutter_actor_paint_node (ClutterActor     *actor,
8156c2
         clear_flags |= COGL_BUFFER_BIT_COLOR;
8156c2
 
8156c2
       node = _clutter_root_node_new (fb, &bg_color, clear_flags);
8156c2
-      clutter_paint_node_set_name (node, "stageClear");
8156c2
+      clutter_paint_node_set_static_name (node, "stageClear");
8156c2
       clutter_paint_node_add_rectangle (node, &box);
8156c2
       clutter_paint_node_add_child (root, node);
8156c2
       clutter_paint_node_unref (node);
8156c2
@@ -3707,7 +3707,7 @@ clutter_actor_paint_node (ClutterActor     *actor,
8156c2
                      / 255;
8156c2
 
8156c2
       node = clutter_color_node_new (&bg_color);
8156c2
-      clutter_paint_node_set_name (node, "backgroundColor");
8156c2
+      clutter_paint_node_set_static_name (node, "backgroundColor");
8156c2
       clutter_paint_node_add_rectangle (node, &box);
8156c2
       clutter_paint_node_add_child (root, node);
8156c2
       clutter_paint_node_unref (node);
8156c2
@@ -4014,7 +4014,7 @@ clutter_actor_continue_paint (ClutterActor *self)
8156c2
            * virtual function can then be called directly.
8156c2
            */
8156c2
           dummy = _clutter_dummy_node_new (self);
8156c2
-          clutter_paint_node_set_name (dummy, "Root");
8156c2
+          clutter_paint_node_set_static_name (dummy, "Root");
8156c2
 
8156c2
           /* XXX - for 1.12, we use the return value of paint_node() to
8156c2
            * decide whether we should emit the ::paint signal.
8156c2
@@ -21129,7 +21129,7 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
8156c2
   color.alpha = clutter_actor_get_paint_opacity_internal (self);
8156c2
 
8156c2
   node = clutter_texture_node_new (texture, &color, priv->min_filter, priv->mag_filter);
8156c2
-  clutter_paint_node_set_name (node, "Texture");
8156c2
+  clutter_paint_node_set_static_name (node, "Texture");
8156c2
 
8156c2
   if (priv->content_repeat == CLUTTER_REPEAT_NONE)
8156c2
     clutter_paint_node_add_rectangle (node, &box);
8156c2
diff --git a/clutter/clutter/clutter-canvas.c b/clutter/clutter/clutter-canvas.c
8156c2
index 42e54ce9d..512e434ed 100644
8156c2
--- a/clutter/clutter/clutter-canvas.c
8156c2
+++ b/clutter/clutter/clutter-canvas.c
8156c2
@@ -319,7 +319,7 @@ clutter_canvas_paint_content (ClutterContent   *content,
8156c2
     return;
8156c2
 
8156c2
   node = clutter_actor_create_texture_paint_node (actor, priv->texture);
8156c2
-  clutter_paint_node_set_name (node, "Canvas Content");
8156c2
+  clutter_paint_node_set_static_name (node, "Canvas Content");
8156c2
   clutter_paint_node_add_child (root, node);
8156c2
   clutter_paint_node_unref (node);
8156c2
 
8156c2
diff --git a/clutter/clutter/clutter-image.c b/clutter/clutter/clutter-image.c
8156c2
index 722b0375d..51e610073 100644
8156c2
--- a/clutter/clutter/clutter-image.c
8156c2
+++ b/clutter/clutter/clutter-image.c
8156c2
@@ -108,7 +108,7 @@ clutter_image_paint_content (ClutterContent   *content,
8156c2
     return;
8156c2
 
8156c2
   node = clutter_actor_create_texture_paint_node (actor, priv->texture);
8156c2
-  clutter_paint_node_set_name (node, "Image Content");
8156c2
+  clutter_paint_node_set_static_name (node, "Image Content");
8156c2
   clutter_paint_node_add_child (root, node);
8156c2
   clutter_paint_node_unref (node);
8156c2
 }
8156c2
diff --git a/clutter/clutter/clutter-paint-node-private.h b/clutter/clutter/clutter-paint-node-private.h
8156c2
index 2945b78a4..ea1665ada 100644
8156c2
--- a/clutter/clutter/clutter-paint-node-private.h
8156c2
+++ b/clutter/clutter/clutter-paint-node-private.h
8156c2
@@ -48,11 +48,11 @@ struct _ClutterPaintNode
8156c2
   ClutterPaintNode *next_sibling;
8156c2
   ClutterPaintNode *last_child;
8156c2
 
8156c2
-  guint n_children;
8156c2
-
8156c2
   GArray *operations;
8156c2
 
8156c2
-  gchar *name;
8156c2
+  const gchar *name;
8156c2
+
8156c2
+  guint n_children;
8156c2
 
8156c2
   volatile int ref_count;
8156c2
 };
8156c2
diff --git a/clutter/clutter/clutter-paint-node.c b/clutter/clutter/clutter-paint-node.c
8156c2
index db68b7766..5129e00cf 100644
8156c2
--- a/clutter/clutter/clutter-paint-node.c
8156c2
+++ b/clutter/clutter/clutter-paint-node.c
8156c2
@@ -173,8 +173,6 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
8156c2
 {
8156c2
   ClutterPaintNode *iter;
8156c2
 
8156c2
-  g_free (node->name);
8156c2
-
8156c2
   if (node->operations != NULL)
8156c2
     {
8156c2
       guint i;
8156c2
@@ -296,7 +294,8 @@ clutter_paint_node_get_type (void)
8156c2
  *
8156c2
  * The @name will be used for debugging purposes.
8156c2
  *
8156c2
- * The @node will copy the passed string.
8156c2
+ * The @node will intern @name using g_intern_string(). If you have access to a
8156c2
+ * static string, use clutter_paint_node_set_static_name() instead.
8156c2
  *
8156c2
  * Since: 1.10
8156c2
  */
8156c2
@@ -306,8 +305,22 @@ clutter_paint_node_set_name (ClutterPaintNode *node,
8156c2
 {
8156c2
   g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
8156c2
 
8156c2
-  g_free (node->name);
8156c2
-  node->name = g_strdup (name);
8156c2
+  node->name = g_intern_string (name);
8156c2
+}
8156c2
+
8156c2
+/**
8156c2
+ * clutter_paint_node_set_static_name: (skip)
8156c2
+ *
8156c2
+ * Like clutter_paint_node_set_name() but uses a static or interned string
8156c2
+ * containing the name.
8156c2
+ */
8156c2
+void
8156c2
+clutter_paint_node_set_static_name (ClutterPaintNode *node,
8156c2
+                                    const char       *name)
8156c2
+{
8156c2
+  g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
8156c2
+
8156c2
+  node->name = name;
8156c2
 }
8156c2
 
8156c2
 /**
8156c2
diff --git a/clutter/clutter/clutter-paint-node.h b/clutter/clutter/clutter-paint-node.h
8156c2
index 5f3e962e4..d3e4e7922 100644
8156c2
--- a/clutter/clutter/clutter-paint-node.h
8156c2
+++ b/clutter/clutter/clutter-paint-node.h
8156c2
@@ -52,6 +52,9 @@ void                    clutter_paint_node_unref                        (Clutter
8156c2
 CLUTTER_AVAILABLE_IN_1_10
8156c2
 void                    clutter_paint_node_set_name                     (ClutterPaintNode      *node,
8156c2
                                                                          const char            *name);
8156c2
+CLUTTER_AVAILABLE_IN_ALL
8156c2
+void                    clutter_paint_node_set_static_name              (ClutterPaintNode      *node,
8156c2
+                                                                         const char            *name);
8156c2
 
8156c2
 CLUTTER_AVAILABLE_IN_1_10
8156c2
 void                    clutter_paint_node_add_child                    (ClutterPaintNode      *node,
8156c2
-- 
8156c2
2.26.0
8156c2