[gnome-builder] documentation-card: use gtk_widget_destroyed



commit 5c0683205f3e1eb3b91728834c186f2453d1df37
Author: Christian Hergert <chergert redhat com>
Date:   Sun Aug 20 12:19:38 2017 -0700

    documentation-card: use gtk_widget_destroyed
    
    This helps us to ensure our pointer is always cleared when the widget is
    destroyed.

 .../gbp-documentation-card-view-addin.c            |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/plugins/documentation-card/gbp-documentation-card-view-addin.c 
b/plugins/documentation-card/gbp-documentation-card-view-addin.c
index 558b14e..aea5400 100644
--- a/plugins/documentation-card/gbp-documentation-card-view-addin.c
+++ b/plugins/documentation-card/gbp-documentation-card-view-addin.c
@@ -204,6 +204,10 @@ gbp_documentation_card_view_addin_load (IdeEditorViewAddin *addin,
                                 "position", GTK_POS_TOP,
                                 "modal", FALSE,
                                  NULL);
+  g_signal_connect (self->popover,
+                    "destroy",
+                    G_CALLBACK (gtk_widget_destroyed),
+                    &self->popover);
   self->motion_handler_id =
     g_signal_connect_object (view,
                             "motion-notify-event",
@@ -226,10 +230,11 @@ gbp_documentation_card_view_addin_unload (IdeEditorViewAddin *addin,
 
   ide_clear_source (&self->timeout_id);
   ide_clear_signal_handler (self->editor_view, &self->motion_handler_id);
-
   g_clear_pointer (&self->previous_text, g_free);
-  gtk_widget_destroy (GTK_WIDGET (self->popover));
-  self->popover = NULL;
+
+  if (self->popover != NULL)
+    gtk_widget_destroy (GTK_WIDGET (self->popover));
+
   self->editor_view = NULL;
 
 }


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