gnome-software/0001-crash-with-broken-theme.patch
2023-01-09 09:52:04 +01:00

34 lines
1.3 KiB
Diff

diff -up gnome-software-devel/src/gs-feature-tile.c.1 gnome-software-devel/src/gs-feature-tile.c
--- gnome-software-devel/src/gs-feature-tile.c.1 2023-01-02 17:08:54.157641969 +0100
+++ gnome-software-devel/src/gs-feature-tile.c 2023-01-02 17:09:36.881632780 +0100
@@ -397,9 +397,6 @@ gs_feature_tile_refresh (GsAppTile *self
if (key_colors != tile->key_colors_cache) {
g_autoptr(GArray) colors = NULL;
GdkRGBA fg_rgba;
-#if !GTK_CHECK_VERSION(4, 9, 2)
- gboolean fg_rgba_valid;
-#endif
GsHSBC fg_hsbc;
const GsHSBC *chosen_hsbc;
GsHSBC chosen_hsbc_modified;
@@ -424,8 +421,17 @@ gs_feature_tile_refresh (GsAppTile *self
gtk_widget_get_color (GTK_WIDGET (self), &fg_rgba);
#else
context = gtk_widget_get_style_context (GTK_WIDGET (self));
- fg_rgba_valid = gtk_style_context_lookup_color (context, "theme_fg_color", &fg_rgba);
- g_assert (fg_rgba_valid);
+ if (!gtk_style_context_lookup_color (context, "theme_fg_color", &fg_rgba)) {
+ static gboolean i_know = FALSE;
+ if (!i_know) {
+ i_know = TRUE;
+ g_warning ("The theme doesn't provide 'theme_fg_color', fallbacking to black");
+ }
+ fg_rgba.red = 0.0;
+ fg_rgba.green = 0.0;
+ fg_rgba.blue = 0.0;
+ fg_rgba.alpha = 1.0;
+ }
#endif
gtk_rgb_to_hsv (fg_rgba.red, fg_rgba.green, fg_rgba.blue,