[gnome-shell/gnome-40] st/icon: Only get resource-scale after peeking theme node



commit f8eb24e3dcc7522faa6bba4ef697636f393b12b1
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 4 19:46:34 2021 +0200

    st/icon: Only get resource-scale after peeking theme node
    
    If an actor is not on any stage view, then it doesn't have a valid
    resource scale, which will hit an assert later.
    
    When that is the case (for example when running headless), we expect
    that there is no valid theme node (yet) either, so simply moving
    the clutter_actor_get_resource_scale() call after peeking at the
    theme node is enough to avoid the crash.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4522
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1935>
    (cherry picked from commit 6e629c0f1045bde6c7efdfc40e5b3a3383e433df)

 src/st/st-icon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index c43d7c91bd..0405d85259 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -456,12 +456,12 @@ st_icon_update (StIcon *icon)
       return;
     }
 
-  resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (icon));
-
   theme_node = st_widget_peek_theme_node (ST_WIDGET (icon));
   if (theme_node == NULL)
     return;
 
+  resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (icon));
+
   stage = clutter_actor_get_stage (CLUTTER_ACTOR (icon));
   context = st_theme_context_get_for_stage (CLUTTER_STAGE (stage));
   g_object_get (context, "scale-factor", &paint_scale, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]