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

99364f
From df565fcb681a50aac5046981c5aba04073d14856 Mon Sep 17 00:00:00 2001
99364f
From: Christian Hergert <christian@hergert.me>
99364f
Date: Fri, 21 Feb 2020 22:36:31 +0000
99364f
Subject: [PATCH 3/3] clutter: fix hole in ClutterPaintNode
99364f
99364f
Fixing the missalignment takes the structure from 80 bytes down to 72.
99364f
99364f
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1081
99364f
---
99364f
 clutter/clutter/clutter-actor.c              |  8 +++----
99364f
 clutter/clutter/clutter-canvas.c             |  2 +-
99364f
 clutter/clutter/clutter-image.c              |  2 +-
99364f
 clutter/clutter/clutter-paint-node-private.h |  6 ++---
99364f
 clutter/clutter/clutter-paint-node.c         | 23 +++++++++++++++-----
99364f
 clutter/clutter/clutter-paint-node.h         |  3 +++
99364f
 6 files changed, 30 insertions(+), 14 deletions(-)
99364f
99364f
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
99364f
index 93d0a93ef..ff5c4a69d 100644
99364f
--- a/clutter/clutter/clutter-actor.c
99364f
+++ b/clutter/clutter/clutter-actor.c
99364f
@@ -3758,7 +3758,7 @@ clutter_actor_paint_node (ClutterActor     *actor,
99364f
         clear_flags |= COGL_BUFFER_BIT_COLOR;
99364f
 
99364f
       node = clutter_root_node_new (fb, &bg_color, clear_flags);
99364f
-      clutter_paint_node_set_name (node, "stageClear");
99364f
+      clutter_paint_node_set_static_name (node, "stageClear");
99364f
       clutter_paint_node_add_rectangle (node, &box);
99364f
       clutter_paint_node_add_child (root, node);
99364f
       clutter_paint_node_unref (node);
99364f
@@ -3773,7 +3773,7 @@ clutter_actor_paint_node (ClutterActor     *actor,
99364f
                      / 255;
99364f
 
99364f
       node = clutter_color_node_new (&bg_color);
99364f
-      clutter_paint_node_set_name (node, "backgroundColor");
99364f
+      clutter_paint_node_set_static_name (node, "backgroundColor");
99364f
       clutter_paint_node_add_rectangle (node, &box);
99364f
       clutter_paint_node_add_child (root, node);
99364f
       clutter_paint_node_unref (node);
99364f
@@ -4069,7 +4069,7 @@ clutter_actor_continue_paint (ClutterActor *self)
99364f
            * virtual function can then be called directly.
99364f
            */
99364f
           dummy = _clutter_dummy_node_new (self);
99364f
-          clutter_paint_node_set_name (dummy, "Root");
99364f
+          clutter_paint_node_set_static_name (dummy, "Root");
99364f
 
99364f
           /* XXX - for 1.12, we use the return value of paint_node() to
99364f
            * decide whether we should emit the ::paint signal.
99364f
@@ -21427,7 +21427,7 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
99364f
   color.alpha = clutter_actor_get_paint_opacity_internal (self);
99364f
 
99364f
   node = clutter_texture_node_new (texture, &color, priv->min_filter, priv->mag_filter);
99364f
-  clutter_paint_node_set_name (node, "Texture");
99364f
+  clutter_paint_node_set_static_name (node, "Texture");
99364f
 
99364f
   if (priv->content_repeat == CLUTTER_REPEAT_NONE)
99364f
     clutter_paint_node_add_rectangle (node, &box);
99364f
diff --git a/clutter/clutter/clutter-canvas.c b/clutter/clutter/clutter-canvas.c
99364f
index b0f1f080c..89c031be2 100644
99364f
--- a/clutter/clutter/clutter-canvas.c
99364f
+++ b/clutter/clutter/clutter-canvas.c
99364f
@@ -351,7 +351,7 @@ clutter_canvas_paint_content (ClutterContent   *content,
99364f
     return;
99364f
 
99364f
   node = clutter_actor_create_texture_paint_node (actor, priv->texture);
99364f
-  clutter_paint_node_set_name (node, "Canvas Content");
99364f
+  clutter_paint_node_set_static_name (node, "Canvas Content");
99364f
   clutter_paint_node_add_child (root, node);
99364f
   clutter_paint_node_unref (node);
99364f
 
99364f
diff --git a/clutter/clutter/clutter-image.c b/clutter/clutter/clutter-image.c
99364f
index 266c68799..790e09521 100644
99364f
--- a/clutter/clutter/clutter-image.c
99364f
+++ b/clutter/clutter/clutter-image.c
99364f
@@ -129,7 +129,7 @@ clutter_image_paint_content (ClutterContent   *content,
99364f
     return;
99364f
 
99364f
   node = clutter_actor_create_texture_paint_node (actor, priv->texture);
99364f
-  clutter_paint_node_set_name (node, "Image Content");
99364f
+  clutter_paint_node_set_static_name (node, "Image Content");
99364f
   clutter_paint_node_add_child (root, node);
99364f
   clutter_paint_node_unref (node);
99364f
 }
99364f
diff --git a/clutter/clutter/clutter-paint-node-private.h b/clutter/clutter/clutter-paint-node-private.h
99364f
index d61b89951..720df1458 100644
99364f
--- a/clutter/clutter/clutter-paint-node-private.h
99364f
+++ b/clutter/clutter/clutter-paint-node-private.h
99364f
@@ -48,11 +48,11 @@ struct _ClutterPaintNode
99364f
   ClutterPaintNode *next_sibling;
99364f
   ClutterPaintNode *last_child;
99364f
 
99364f
-  guint n_children;
99364f
-
99364f
   GArray *operations;
99364f
 
99364f
-  gchar *name;
99364f
+  const gchar *name;
99364f
+
99364f
+  guint n_children;
99364f
 
99364f
   volatile int ref_count;
99364f
 };
99364f
diff --git a/clutter/clutter/clutter-paint-node.c b/clutter/clutter/clutter-paint-node.c
99364f
index 73765a4e9..1f9451a43 100644
99364f
--- a/clutter/clutter/clutter-paint-node.c
99364f
+++ b/clutter/clutter/clutter-paint-node.c
99364f
@@ -171,8 +171,6 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
99364f
 {
99364f
   ClutterPaintNode *iter;
99364f
 
99364f
-  g_free (node->name);
99364f
-
99364f
   if (node->operations != NULL)
99364f
     {
99364f
       guint i;
99364f
@@ -294,7 +292,8 @@ clutter_paint_node_get_type (void)
99364f
  *
99364f
  * The @name will be used for debugging purposes.
99364f
  *
99364f
- * The @node will copy the passed string.
99364f
+ * The @node will intern @name using g_intern_string(). If you have access to a
99364f
+ * static string, use clutter_paint_node_set_static_name() instead.
99364f
  *
99364f
  * Since: 1.10
99364f
  */
99364f
@@ -304,8 +303,22 @@ clutter_paint_node_set_name (ClutterPaintNode *node,
99364f
 {
99364f
   g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
99364f
 
99364f
-  g_free (node->name);
99364f
-  node->name = g_strdup (name);
99364f
+  node->name = g_intern_string (name);
99364f
+}
99364f
+
99364f
+/**
99364f
+ * clutter_paint_node_set_static_name: (skip)
99364f
+ *
99364f
+ * Like clutter_paint_node_set_name() but uses a static or interned string
99364f
+ * containing the name.
99364f
+ */
99364f
+void
99364f
+clutter_paint_node_set_static_name (ClutterPaintNode *node,
99364f
+                                    const char       *name)
99364f
+{
99364f
+  g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
99364f
+
99364f
+  node->name = name;
99364f
 }
99364f
 
99364f
 /**
99364f
diff --git a/clutter/clutter/clutter-paint-node.h b/clutter/clutter/clutter-paint-node.h
99364f
index c42abbc3d..7d25f1681 100644
99364f
--- a/clutter/clutter/clutter-paint-node.h
99364f
+++ b/clutter/clutter/clutter-paint-node.h
99364f
@@ -55,6 +55,9 @@ void                    clutter_paint_node_paint                        (Clutter
99364f
 CLUTTER_EXPORT
99364f
 void                    clutter_paint_node_set_name                     (ClutterPaintNode      *node,
99364f
                                                                          const char            *name);
99364f
+CLUTTER_EXPORT
99364f
+void                    clutter_paint_node_set_static_name              (ClutterPaintNode      *node,
99364f
+                                                                         const char            *name);
99364f
 
99364f
 CLUTTER_EXPORT
99364f
 void                    clutter_paint_node_add_child                    (ClutterPaintNode      *node,
99364f
-- 
99364f
2.26.0
99364f