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.
This commit is contained in:
Timm Bäder 2017-04-29 14:25:36 +02:00
parent cbcf10411c
commit 3e2187975d

View File

@ -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;