st/theme-context: Also invalidate root node on stylesheet changes

Since commit 6a42d77261 we invalidate the
cached properties for each theme node on stylesheet changes by iterating
over the hashtable of the theme context instead of listening to the
signal in each individual theme node.

That commit forgot one particular node though that's not stored in the
hashtable, but using the `priv->root_node` property instead: The theme
node that belongs to the stage.

So make sure we also invalidate the cached properties of the stage theme
node on stylesheet changes. This fixes various crashes that happened
with extensions providing custom stylesheets (emitting the
"custom-stylesheets-changed" signal on every extension enable/disable),
trying to access an already freed CSS property of the stage.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2584
This commit is contained in:
Jonas Dreßler 2020-04-06 02:11:27 +02:00 committed by Carlos Garnacho
parent 85846d88f0
commit bc973b80d7

View File

@ -297,6 +297,9 @@ on_custom_stylesheets_changed (StTheme *theme,
GHashTableIter iter;
StThemeNode *node;
if (context->root_node)
_st_theme_node_reset_for_stylesheet_change (context->root_node);
g_hash_table_iter_init (&iter, context->nodes);
while (g_hash_table_iter_next (&iter, (gpointer *) &node, NULL))