[glib: 5/9] GWin32AppInfo: Check for task cancellation




commit 42a76e1631c85784824c793038b907ed7f4e1bf1
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Fri Aug 12 19:08:38 2022 +0200

    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 2eeaa62799..722f4660b8 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));
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]