[gtk+/gtk-3-20] menu: Free gadgets in finalize



commit 76f7e57fb6174be39eabf2ddee2aaf892d14af85
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 5 19:34:30 2016 -0400

    menu: Free gadgets in finalize
    
    This is the right place to do this.

 gtk/gtkmenu.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index a811a23..3e83871 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -214,6 +214,7 @@ static void     gtk_menu_get_property      (GObject          *object,
                                             guint             prop_id,
                                             GValue           *value,
                                             GParamSpec       *pspec);
+static void     gtk_menu_finalize          (GObject          *object);
 static void     gtk_menu_set_child_property(GtkContainer     *container,
                                             GtkWidget        *child,
                                             guint             property_id,
@@ -511,6 +512,7 @@ gtk_menu_class_init (GtkMenuClass *class)
   
   gobject_class->set_property = gtk_menu_set_property;
   gobject_class->get_property = gtk_menu_get_property;
+  gobject_class->finalize = gtk_menu_finalize;
 
   widget_class->destroy = gtk_menu_destroy;
   widget_class->realize = gtk_menu_realize;
@@ -1208,10 +1210,19 @@ gtk_menu_destroy (GtkWidget *widget)
       priv->position_func_data_destroy = NULL;
     }
 
+  GTK_WIDGET_CLASS (gtk_menu_parent_class)->destroy (widget);
+}
+
+static void
+gtk_menu_finalize (GObject *object)
+{
+  GtkMenu *menu = GTK_MENU (object);
+  GtkMenuPrivate *priv = menu->priv;
+
   g_clear_object (&priv->top_arrow_gadget);
   g_clear_object (&priv->bottom_arrow_gadget);
 
-  GTK_WIDGET_CLASS (gtk_menu_parent_class)->destroy (widget);
+  G_OBJECT_CLASS (gtk_menu_parent_class)->finalize (object);
 }
 
 static void


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