Blame SOURCES/0001-clutter-text-Don-t-query-preferred-size-without-allo.patch

8a83d7
From 5cd66485cdd99068dab0f57d7f64d3ef294b0037 Mon Sep 17 00:00:00 2001
8a83d7
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
8a83d7
Date: Wed, 4 Aug 2021 19:30:10 +0200
8a83d7
Subject: [PATCH] clutter/text: Don't query preferred size without allocation
8a83d7
8a83d7
The size request functions query the resource scale, which hits
8a83d7
an assert if headless. The returned sizes are already only used
8a83d7
when clutter_actor_has_allocation() is true, so this doesn't
8a83d7
change the condition for calling either redraw or relayout.
8a83d7
8a83d7
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4522
8a83d7
8a83d7
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1956>
8a83d7
---
8a83d7
 clutter/clutter/clutter-text.c | 17 +++++++++++------
8a83d7
 1 file changed, 11 insertions(+), 6 deletions(-)
8a83d7
8a83d7
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
8a83d7
index 45c7eac56b..80e53ea32f 100644
8a83d7
--- a/clutter/clutter/clutter-text.c
8a83d7
+++ b/clutter/clutter/clutter-text.c
8a83d7
@@ -4797,16 +4797,21 @@ static void
8a83d7
 clutter_text_queue_redraw_or_relayout (ClutterText *self)
8a83d7
 {
8a83d7
   ClutterActor *actor = CLUTTER_ACTOR (self);
8a83d7
-  gfloat preferred_width;
8a83d7
-  gfloat preferred_height;
8a83d7
+  float preferred_width = -1.;
8a83d7
+  float preferred_height = -1.;
8a83d7
 
8a83d7
   clutter_text_dirty_cache (self);
8a83d7
 
8a83d7
-  /* we're using our private implementations here to avoid the caching done by ClutterActor */
8a83d7
-  clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width);
8a83d7
-  clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
8a83d7
+  if (clutter_actor_has_allocation (actor))
8a83d7
+    {
8a83d7
+      /* we're using our private implementations here to avoid the caching done by ClutterActor */
8a83d7
+      clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width);
8a83d7
+      clutter_text_get_preferred_height (actor, preferred_width, NULL,
8a83d7
+                                         &preferred_height);
8a83d7
+    }
8a83d7
 
8a83d7
-  if (clutter_actor_has_allocation (actor) &&
8a83d7
+  if (preferred_width > 0 &&
8a83d7
+      preferred_height > 0 &&
8a83d7
       fabsf (preferred_width - clutter_actor_get_width (actor)) <= 0.001 &&
8a83d7
       fabsf (preferred_height - clutter_actor_get_height (actor)) <= 0.001)
8a83d7
     clutter_text_queue_redraw (actor);
8a83d7
-- 
8a83d7
2.31.1
8a83d7