[gtk+] popover: dispose popovers when unmanaging them



commit aa7e00fcb82392abae14ad431619bfdee882bafa
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Mar 6 18:59:40 2014 +0100

    popover: dispose popovers when unmanaging them
    
    This makes popovers get rid of dangling pointers at the time of destroying
    the relative-to widget, just in case these are kept alive by a reference.

 gtk/gtkpopover.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 7cadf98..8e1c56b 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1384,6 +1384,13 @@ _gtk_popover_parent_size_allocate (GtkWidget     *widget,
 }
 
 static void
+_unmanage_popover (GObject *object)
+{
+  g_object_run_dispose (object);
+  g_object_unref (object);
+}
+
+static void
 widget_manage_popover (GtkWidget  *widget,
                        GtkPopover *popover)
 {
@@ -1394,7 +1401,7 @@ widget_manage_popover (GtkWidget  *widget,
   if (G_UNLIKELY (!popovers))
     {
       popovers = g_hash_table_new_full (NULL, NULL,
-                                        (GDestroyNotify) g_object_unref, NULL);
+                                        (GDestroyNotify) _unmanage_popover, NULL);
       g_object_set_qdata_full (G_OBJECT (widget),
                                quark_widget_popovers, popovers,
                                (GDestroyNotify) g_hash_table_unref);


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