From 3e2187975d4d620630cc8c655d36a92ec423c632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 29 Apr 2017 14:25:36 +0200 Subject: [PATCH] gappinfo: Clear previously set error before calling portal Otherwise, we might end up returning TRUE from g_app_info_launch_default_for_uri but with a set error parameter. This will lead to confusing results depending on how the caller checks for errors. Checking error != NULL indicats the call failed but checking the return value indicates that it succeeded. --- gio/gappinfo.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gio/gappinfo.c b/gio/gappinfo.c index 4c8c2881f..ba5815568 100644 --- a/gio/gappinfo.c +++ b/gio/gappinfo.c @@ -984,7 +984,12 @@ g_app_info_launch_default_for_uri (const char *uri, #ifdef G_OS_UNIX if (glib_should_use_portal ()) - return launch_default_with_portal (uri, launch_context, error); + { + /* Reset any error previously set by launch_default_for_uri */ + g_clear_error (error); + + return launch_default_with_portal (uri, launch_context, error); + } #endif return FALSE;