diff --git a/SOURCES/xdg-desktop-portal-1.6.0-fix-openuri-crash.patch b/SOURCES/xdg-desktop-portal-1.6.0-fix-openuri-crash.patch new file mode 100644 index 0000000..639b237 --- /dev/null +++ b/SOURCES/xdg-desktop-portal-1.6.0-fix-openuri-crash.patch @@ -0,0 +1,53 @@ +From 406a8849261e6301a66b7f1ece35051afd828592 Mon Sep 17 00:00:00 2001 +From: Simon McVittie +Date: Sun, 6 Sep 2020 15:32:14 +0100 +Subject: [PATCH] open-uri: Don't crash if there is no default or latest app + +g_desktop_app_info_new() requires a non-NULL argument. + +Partially addresses #524. + +Fixes: 69205f12 "open-uri: Show app chooser when default app does not exist" +Signed-off-by: Simon McVittie +--- + src/open-uri.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/open-uri.c b/src/open-uri.c +index bb63478..f746e64 100644 +--- a/src/open-uri.c ++++ b/src/open-uri.c +@@ -555,6 +555,8 @@ app_exists (const char *app_id) + { + g_autoptr(GDesktopAppInfo) info = NULL; + ++ g_return_val_if_fail (app_id != NULL, FALSE); ++ + info = g_desktop_app_info_new (app_id); + return (info != NULL); + } +@@ -667,13 +669,13 @@ handle_open_in_thread_func (GTask *task, + + /* collect all the information */ + find_recommended_choices (scheme, content_type, &default_app, &choices, &n_choices); +- if (!app_exists (default_app)) ++ if (default_app != NULL && !app_exists (default_app)) + g_clear_pointer (&default_app, g_free); + use_default_app = should_use_default_app (scheme, content_type); + get_latest_choice_info (app_id, content_type, + &latest_id, &latest_count, &latest_threshold, + &ask_for_content_type); +- if (!app_exists (latest_id)) ++ if (latest_id != NULL && !app_exists (latest_id)) + g_clear_pointer (&latest_id, g_free); + + skip_app_chooser = FALSE; +@@ -729,7 +731,7 @@ handle_open_in_thread_func (GTask *task, + app = latest_id; + else if (default_app != NULL) + app = default_app; +- else if (choices && app_exists (choices[0])) ++ else if (n_choices > 0 && app_exists (choices[0])) + app = choices[0]; + + if (app) diff --git a/SPECS/xdg-desktop-portal.spec b/SPECS/xdg-desktop-portal.spec index a51f974..3316afc 100644 --- a/SPECS/xdg-desktop-portal.spec +++ b/SPECS/xdg-desktop-portal.spec @@ -3,7 +3,7 @@ Name: xdg-desktop-portal Version: 1.6.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Portal frontend service to flatpak License: LGPLv2+ @@ -22,6 +22,8 @@ Patch6: 0005-open-uri-avoid-criticals-when-app-to-open-does-not-e.patch # Build against older glib2 Patch7: 0001-Don-t-use-g_strv_equals.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1886776 +Patch8: xdg-desktop-portal-1.6.0-fix-openuri-crash.patch BuildRequires: gcc BuildRequires: pkgconfig(flatpak) @@ -117,6 +119,9 @@ install -dm 755 %{buildroot}/%{_datadir}/%{name}/portals %changelog +* Fri Oct 09 2020 David King - 1.6.0-3 +- Fix OpenURI crash (#1886776) + * Thu Jul 15 2020 Jonas Ã…dahl - 1.6.0-2 - Require pipewire0.2-libs for legacy application support. Resolves: #1854734