From 42a76e1631c85784824c793038b907ed7f4e1bf1 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Fri, 12 Aug 2022 19:08:38 +0200 Subject: [PATCH] GWin32AppInfo: Check for task cancellation We cannot cancel a spawn operation, but sometimes we have to spawn the target application mutiple times (e.g. in case the target app only supports one URI in its command-line, but we were given multiple URI's), in that case continuously check the cancellation status before attempting any spawn operation --- gio/gwin32appinfo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c index 2eeaa6279..722f4660b 100644 --- a/gio/gwin32appinfo.c +++ b/gio/gwin32appinfo.c @@ -5110,6 +5110,9 @@ g_win32_app_info_launch_internal (GWin32AppInfo *info, do { + if (from_task && g_task_return_error_if_cancelled (from_task)) + goto out; + if (!expand_application_parameters (info, command, &objs, @@ -5403,7 +5406,7 @@ launch_uris_async_thread (GTask *task, succeeded = g_win32_app_info_launch_uris_impl (appinfo, data->uris, data->context, task, &local_error); if (succeeded) g_task_return_boolean (task, TRUE); - else + else if (!g_task_had_error (task)) g_task_return_error (task, g_steal_pointer (&local_error)); }