[gnome-builder/gnome-builder-3-18] devhelp-panel: fix active view cleanup



commit 93ef36667b6d8c4e5e50b2d8d5ab50ff84d44a10
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Tue Sep 29 18:11:35 2015 +0200

    devhelp-panel: fix active view cleanup
    
    devhelp maintain a weak pointer on active view but
    for the last view, the active-view signal is called
    before the weak pointer and we disconnect and unref
    on an already destroyed object.

 plugins/devhelp/gb-devhelp-panel.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/plugins/devhelp/gb-devhelp-panel.c b/plugins/devhelp/gb-devhelp-panel.c
index 6682780..d4cb3e7 100644
--- a/plugins/devhelp/gb-devhelp-panel.c
+++ b/plugins/devhelp/gb-devhelp-panel.c
@@ -106,14 +106,18 @@ notify_active_view_cb (GbDevhelpPanel *self,
   g_assert (GB_IS_DEVHELP_PANEL (self));
   g_assert (GB_IS_WORKBENCH (workbench));
 
-  if (self->current_view)
+  view = gb_workbench_get_active_view (workbench);
+
+  /* If the active view is NULL, the current view is already destroyed but
+   * the weak pointer has not been call yet so self->current_view is not NULL
+   */
+  if (view != NULL && self->current_view)
     {
       g_signal_handler_disconnect (self->current_view, self->current_view_handler);
       self->current_view_handler = 0;
       ide_clear_weak_pointer (&self->current_view);
     }
 
-  view = gb_workbench_get_active_view (workbench);
   if (!GB_IS_EDITOR_VIEW (view))
     return;
 


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