[gnome-builder] threading: add cancellation checks for IdeObject



commit 23986cd8616134e9f2d921e6b7be7bf7dac6b47c
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jan 18 13:05:41 2019 -0800

    threading: add cancellation checks for IdeObject

 src/libide/threading/ide-task.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/threading/ide-task.c b/src/libide/threading/ide-task.c
index 1f082e34d..a7a1aea9d 100644
--- a/src/libide/threading/ide-task.c
+++ b/src/libide/threading/ide-task.c
@@ -1354,6 +1354,10 @@ ide_task_return_new_error (IdeTask     *self,
  * Returns a new #GError if the cancellable associated with the task
  * has been cancelled. If so, %TRUE is returned, otherwise %FALSE.
  *
+ * If the source object related to the task is an #IdeObject and that
+ * object has had been requested to destroy, it too will be considered
+ * a cancellation state.
+ *
  * Returns: %TRUE if the task was cancelled and error returned.
  *
  * Since: 3.32
@@ -1367,7 +1371,9 @@ ide_task_return_error_if_cancelled (IdeTask *self)
   g_return_val_if_fail (IDE_IS_TASK (self), FALSE);
 
   g_mutex_lock (&priv->mutex);
-  failed = g_cancellable_is_cancelled (priv->cancellable);
+  failed = g_cancellable_is_cancelled (priv->cancellable) ||
+    (IDE_IS_OBJECT (priv->source_object) &&
+     ide_object_in_destruction (IDE_OBJECT (priv->source_object)));
   g_mutex_unlock (&priv->mutex);
 
   if (failed)


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