[gnome-builder] libide: Unload services before destroying RuntimeManager



commit e05d229a89f4b734fa73ef082d2e87f320b65887
Author: Anoop Chandu <anoopchandu96 gmail com>
Date:   Sat Aug 26 21:16:10 2017 +0530

    libide: Unload services before destroying RuntimeManager
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786700

 libide/ide-context.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/libide/ide-context.c b/libide/ide-context.c
index 0f1166e..c3787b0 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -563,6 +563,8 @@ ide_context_finalize (GObject *object)
 
   IDE_ENTRY;
 
+  g_clear_object (&self->services);
+
   g_clear_pointer (&self->build_system_hint, g_free);
   g_clear_pointer (&self->services_by_gtype, g_hash_table_unref);
   g_clear_pointer (&self->root_build_dir, g_free);
@@ -576,7 +578,6 @@ ide_context_finalize (GObject *object)
   g_clear_object (&self->project_file);
   g_clear_object (&self->recent_manager);
   g_clear_object (&self->runtime_manager);
-  g_clear_object (&self->services);
   g_clear_object (&self->transfer_manager);
   g_clear_object (&self->unsaved_files);
   g_clear_object (&self->vcs);
@@ -2041,13 +2042,17 @@ ide_context_unload_cb (GObject      *object,
                        GAsyncResult *result,
                        gpointer      user_data)
 {
+  IdeContext *self = (IdeContext *)object;
   GTask *unload_task = (GTask *)result;
   g_autoptr(GTask) task = user_data;
   GError *error = NULL;
 
-  g_assert (IDE_IS_CONTEXT (object));
+  g_assert (IDE_IS_CONTEXT (self));
   g_assert (G_IS_TASK (task));
 
+  g_clear_object (&self->device_manager);
+  g_clear_object (&self->runtime_manager);
+
   if (!g_task_propagate_boolean (unload_task, &error))
     g_task_return_error (task, error);
   else
@@ -2065,9 +2070,6 @@ ide_context_do_unload_locked (IdeContext *self)
   task = self->delayed_unload_task;
   self->delayed_unload_task = NULL;
 
-  g_clear_object (&self->device_manager);
-  g_clear_object (&self->runtime_manager);
-
   ide_async_helper_run (self,
                         g_task_get_cancellable (task),
                         ide_context_unload_cb,


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