diff --git a/gtk2-check-attribute.patch b/gtk2-check-attribute.patch new file mode 100644 index 0000000..4068edc --- /dev/null +++ b/gtk2-check-attribute.patch @@ -0,0 +1,54 @@ +diff -ru orig/gtk/gtkfilechooserdefault.c mod/gtk/gtkfilechooserdefault.c +--- orig/gtk/gtkfilechooserdefault.c 2020-12-21 02:09:37.000000000 +0100 ++++ mod/gtk/gtkfilechooserdefault.c 2023-11-29 13:03:45.032522071 +0100 +@@ -6378,10 +6378,12 @@ + if (!_gtk_file_system_model_iter_is_visible (fsmodel, &iter)) + { + GFileInfo *info = _gtk_file_system_model_get_info (fsmodel, &iter); ++ gboolean has_is_hidden = g_file_info_has_attribute (info, "standard::is-hidden"); ++ gboolean has_is_backup = g_file_info_has_attribute (info, "standard::is-backup"); + + if (!enabled_hidden && +- (g_file_info_get_is_hidden (info) || +- g_file_info_get_is_backup (info))) ++ ((has_is_hidden && g_file_info_get_is_hidden (info)) || ++ (has_is_backup && g_file_info_get_is_backup (info)))) + { + g_object_set (impl, "show-hidden", TRUE, NULL); + enabled_hidden = TRUE; +diff -ru orig/gtk/gtkfilesystemmodel.c mod/gtk/gtkfilesystemmodel.c +--- orig/gtk/gtkfilesystemmodel.c 2020-12-21 02:09:37.000000000 +0100 ++++ mod/gtk/gtkfilesystemmodel.c 2023-11-29 13:03:50.525885624 +0100 +@@ -444,13 +444,18 @@ + node_should_be_visible (GtkFileSystemModel *model, guint id, gboolean filtered_out) + { + FileModelNode *node = get_node (model, id); ++ gboolean has_is_hidden, has_is_backup; + gboolean result; + + if (node->info == NULL) + return FALSE; ++ ++ has_is_hidden = g_file_info_has_attribute (node->info, "standard::is-hidden"); ++ has_is_backup = g_file_info_has_attribute (node->info, "standard::is-backup"); + + if (!model->show_hidden && +- (g_file_info_get_is_hidden (node->info) || g_file_info_get_is_backup (node->info))) ++ ((has_is_hidden && g_file_info_get_is_hidden (node->info)) || ++ (has_is_backup && g_file_info_get_is_backup (node->info)))) + return FALSE; + + if (_gtk_file_info_consider_as_directory (node->info)) +diff -ru orig/gtk/gtkpathbar.c mod/gtk/gtkpathbar.c +--- orig/gtk/gtkpathbar.c 2020-12-21 02:09:37.000000000 +0100 ++++ mod/gtk/gtkpathbar.c 2023-11-29 13:03:55.749247694 +0100 +@@ -1659,7 +1659,8 @@ + } + + display_name = g_file_info_get_display_name (info); +- is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info); ++ is_hidden = g_file_info_get_attribute_boolean (info, "standard::is-hidden") || ++ g_file_info_get_attribute_boolean (info, "standard::is-backup"); + + gtk_widget_push_composite_child (); + button_data = make_directory_button (file_info->path_bar, display_name, diff --git a/gtk2.changes b/gtk2.changes index dfd9aeb..4aed211 100644 --- a/gtk2.changes +++ b/gtk2.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Nov 29 12:04:39 UTC 2023 - Paolo Stivanin + +- Add gtk2-check-attribute.patch (bsc#1217622): check for attribute + availability before accessing it. + Starting from GLib 2.76, the standard attribute getters in the + GFileInfo object will warn if the attribute is unset, instead of + silently bailing out and returning a default value. + ------------------------------------------------------------------- Tue Nov 28 11:52:33 UTC 2023 - Dominique Leuenberger diff --git a/gtk2.spec b/gtk2.spec index 3a2dbfd..0d9e8f8 100644 --- a/gtk2.spec +++ b/gtk2.spec @@ -50,6 +50,8 @@ Patch5: gtk2-bgo625202-30-bit-drawables-remain-black.patch Patch6: gtk2-bgo743166-remember-printing-authentication.patch # PATCH-FEATURE-OPENSUSE gtk2-updateiconcache_sort.patch olh@opensuse.org -- Have gtp-update-icon-cache sort the file list before producing a cache Patch8: gtk2-updateiconcache_sort.patch +# PATCH-FIX-UPSTREAM https://gitlab.gnome.org/GNOME/gtk/-/commit/c1fa916e88de20fc61dc06d3ff9f26722effa0df#note_1852594 - Check for attribute availability before accessing it +Patch9: gtk2-check-attribute.patch BuildRequires: cairo-devel BuildRequires: cups-devel BuildRequires: fdupes @@ -324,6 +326,7 @@ cp -a %{SOURCE2} . %patch -P 5 -p1 %patch -P 6 -p1 %patch -P 8 -p1 +%patch -P 9 -p1 sed -i "s|/usr/bin/env python|%{_bindir}/python3|" ./gtk/gtk-builder-convert gnome-patch-translation-update