[libhandy/wip/exalm/fixes2: 8/8] view-switcher-title: Null-check view switcher in dispose()



commit 15eee53951c9a1975c0fe8db3bed1ca96d5e0d5a
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Mar 24 21:05:35 2020 +0500

    view-switcher-title: Null-check view switcher in dispose()
    
    If it's NULL, we can't get the stack anymore. This can happen if
    dispose() is called multiple times.

 src/hdy-view-switcher-title.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/hdy-view-switcher-title.c b/src/hdy-view-switcher-title.c
index b6b22447..8d35a6fc 100644
--- a/src/hdy-view-switcher-title.c
+++ b/src/hdy-view-switcher-title.c
@@ -293,10 +293,13 @@ static void
 hdy_view_switcher_title_dispose (GObject *object) {
   HdyViewSwitcherTitle *self = (HdyViewSwitcherTitle *)object;
   HdyViewSwitcherTitlePrivate *priv = hdy_view_switcher_title_get_instance_private (self);
-  GtkStack *stack = hdy_view_switcher_get_stack (priv->view_switcher);
 
-  if (stack)
-    g_signal_handlers_disconnect_by_func (stack, G_CALLBACK (update_view_switcher_visible), self);
+  if (priv->view_switcher) {
+    GtkStack *stack = hdy_view_switcher_get_stack (priv->view_switcher);
+
+    if (stack)
+      g_signal_handlers_disconnect_by_func (stack, G_CALLBACK (update_view_switcher_visible), self);
+  }
 
   G_OBJECT_CLASS (hdy_view_switcher_title_parent_class)->dispose (object);
 }


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