icon-theme: Avoid reentrancy issues while loading icon theme

In gtk_icon_theme_get_for_display() we were calling
gtk_icon_theme_set_display() which eventually (via the css machinery)
called back into gtk_icon_theme_get_for_display() which created a
second icon theme. We avoid this by setting the user-data earlier so
that the css machinery gets back the currently initializing theme
instead.
This commit is contained in:
Alexander Larsson
2020-01-30 18:19:56 +01:00
parent b67d582230
commit d478ae1ef5

View File

@@ -789,12 +789,13 @@ gtk_icon_theme_get_for_display (GdkDisplay *display)
if (!self)
{
self = gtk_icon_theme_new ();
gtk_icon_theme_set_display (self, display);
self->is_display_singleton = TRUE;
g_object_set_data (G_OBJECT (display), I_("gtk-icon-theme"), self);
/* Call this after setting the user-data, because it recurses into gtk_icon_theme_get_for_display via the thememing machinery */
gtk_icon_theme_set_display (self, display);
/* Queue early read of the default themes, we read the icon theme name in _set_display(). */
gtk_icon_theme_load_in_thread (self);
}