[gnome-builder] clang: handle immediate cancellation



commit 0b8f470faebb04bb558790637ebe4582221f9701
Author: Christian Hergert <chergert redhat com>
Date:   Sat May 5 16:41:02 2018 -0700

    clang: handle immediate cancellation
    
    Handle the case where we are cancelled before being called.
    
    Fixes #499

 src/plugins/clang/ide-clang-client.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/clang/ide-clang-client.c b/src/plugins/clang/ide-clang-client.c
index c02e988a1..5f2df535f 100644
--- a/src/plugins/clang/ide-clang-client.c
+++ b/src/plugins/clang/ide-clang-client.c
@@ -512,9 +512,12 @@ ide_clang_client_call_cancelled (GCancellable *cancellable,
   g_assert (G_IS_CANCELLABLE (cancellable));
   g_assert (call != NULL);
   g_assert (call->cancellable == cancellable);
-  g_assert (call->cancel_id != 0);
   g_assert (IDE_IS_CLANG_CLIENT (call->self));
 
+  /* Will be zero if cancelled immediately */
+  if (call->cancel_id == 0)
+    return;
+
   if (call->self->rpc_client == NULL)
     return;
 
@@ -558,6 +561,8 @@ ide_clang_client_call_async (IdeClangClient      *self,
                                                G_CALLBACK (ide_clang_client_call_cancelled),
                                                call,
                                                NULL);
+      if (ide_task_return_error_if_cancelled (task))
+        return;
     }
 
   ide_clang_client_get_client_async (self,


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