summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Bacci <luca.bacci982@gmail.com>2022-08-12 19:08:38 +0200
committerLuca Bacci <luca.bacci982@gmail.com>2022-08-26 11:33:22 +0200
commit42a76e1631c85784824c793038b907ed7f4e1bf1 (patch)
tree732fc63d33313468a7d3581314abdbbd77dfb6d4
parentcff3e660c1b33200f5d46822175f895d85ea5adb (diff)
downloadglib-42a76e1631c85784824c793038b907ed7f4e1bf1.tar.gz
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
-rw-r--r--gio/gwin32appinfo.c5
1 files changed, 4 insertions, 1 deletions
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));
}