[gnome-builder] threading: handle threaded pass to main idle flow



commit c40be22d7942b140a1ea41063c447aa451485aa2
Author: Christian Hergert <chergert redhat com>
Date:   Tue May 4 15:57:53 2021 -0700

    threading: handle threaded pass to main idle flow
    
    If we use ide_task_run_in_thread() is it useful to pass the task back to
    the main thread to complete. This allows that as long as the task is
    completed in the main thread at some point.

 src/libide/threading/ide-task.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/libide/threading/ide-task.c b/src/libide/threading/ide-task.c
index 8e0780295..e7b1bb512 100644
--- a/src/libide/threading/ide-task.c
+++ b/src/libide/threading/ide-task.c
@@ -1137,7 +1137,7 @@ ide_task_return (IdeTask       *self,
    * that thread cleanup must complete this to ensure objects cannot
    * be finalized in that thread.
    */
-  if (!priv->thread_called)
+  if (!priv->thread_called || IDE_IS_MAIN_THREAD ())
     priv->return_source = ide_task_complete (result);
   else if (priv->return_on_cancel && result->type == IDE_TASK_RESULT_CANCELLED)
     priv->return_source = ide_task_complete (result);


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