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

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