[gnome-builder/wip/gtk4-port] plugins/clang: bail early when in shutdown



commit cbdba12d2f18f0664b87a4daaf4753689fb9acf1
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 2 16:27:54 2022 -0700

    plugins/clang: bail early when in shutdown

 src/plugins/clang/ide-clang-client.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/clang/ide-clang-client.c b/src/plugins/clang/ide-clang-client.c
index 1252ab4f0..ba34b4dba 100644
--- a/src/plugins/clang/ide-clang-client.c
+++ b/src/plugins/clang/ide-clang-client.c
@@ -90,6 +90,11 @@ ide_clang_client_sync_buffers (IdeClangClient *self)
 
   g_assert (IDE_IS_CLANG_CLIENT (self));
 
+  /* Bail if we're in destruction */
+  if (self->state == STATE_SHUTDOWN ||
+      !(context = ide_object_get_context (IDE_OBJECT (self))))
+    return;
+
   /*
    * We need to sync buffers to the subprocess, but only those that are of any
    * consequence to us. So that means C, C++, or Obj-C files and headers.
@@ -103,7 +108,6 @@ ide_clang_client_sync_buffers (IdeClangClient *self)
    * be used on subsequence commands).
    */
 
-  context = ide_object_get_context (IDE_OBJECT (self));
   ufs = ide_unsaved_files_from_context (context);
   ar = ide_unsaved_files_to_array (ufs);
   IDE_PTR_ARRAY_SET_FREE_FUNC (ar, ide_unsaved_file_unref);


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