[gnome-builder/wip/chergert/bug1: 8/69] debug-manager: protect against signal disconnects



commit a33a2140e75ca09bfdcff0af7f53ad1d7db482ed
Author: Christian Hergert <chergert redhat com>
Date:   Sat Aug 26 20:04:13 2017 -0700

    debug-manager: protect against signal disconnects
    
    Keep the object alive for the property bindings to cleanly disconnect.

 libide/debugger/ide-debug-manager.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/libide/debugger/ide-debug-manager.c b/libide/debugger/ide-debug-manager.c
index 4882eaf..ddc9d25 100644
--- a/libide/debugger/ide-debug-manager.c
+++ b/libide/debugger/ide-debug-manager.c
@@ -364,14 +364,20 @@ static void
 ide_debug_manager_runner_exited (IdeDebugManager *self,
                                  IdeRunner       *runner)
 {
+  g_autoptr(IdeDebugger) debugger = NULL;
+  g_autoptr(IdeRunner) hold_runner = NULL;
+
   g_assert (IDE_IS_DEBUG_MANAGER (self));
   g_assert (IDE_IS_RUNNER (runner));
 
-  g_clear_object (&self->runner);
-  g_clear_object (&self->debugger);
+  /*
+   * Keep debugger alive so that listeners to :debugger property can
+   * properly disconnect signals when we clear the debugger instance.
+   */
+  debugger = g_steal_pointer (&self->debugger);
+  hold_runner = g_steal_pointer (&self->runner);
 
   ide_debug_manager_set_active (self, FALSE);
-
   g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_DEBUGGER]);
 }
 


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