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



commit 1a6129d815929f76ca9d1512dbfb6af814e7faf4
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 5 19:35:12 2016 -0400

    notebook: Free gadgets in finalize
    
    This is the right place for this.

 gtk/gtknotebook.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 259b79a..77a8a8b 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -353,6 +353,7 @@ static void gtk_notebook_get_property        (GObject         *object,
                                               guint            prop_id,
                                               GValue          *value,
                                               GParamSpec      *pspec);
+static void gtk_notebook_finalize            (GObject         *object);
 
 /*** GtkWidget Methods ***/
 static void gtk_notebook_destroy             (GtkWidget        *widget);
@@ -703,6 +704,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
 
   gobject_class->set_property = gtk_notebook_set_property;
   gobject_class->get_property = gtk_notebook_get_property;
+  gobject_class->finalize = gtk_notebook_finalize;
 
   widget_class->destroy = gtk_notebook_destroy;
   widget_class->map = gtk_notebook_map;
@@ -1830,11 +1832,20 @@ gtk_notebook_destroy (GtkWidget *widget)
   remove_switch_tab_timer (notebook);
 
   GTK_WIDGET_CLASS (gtk_notebook_parent_class)->destroy (widget);
+}
+
+static void
+gtk_notebook_finalize (GObject *object)
+{
+  GtkNotebook *notebook = GTK_NOTEBOOK (object);
+  GtkNotebookPrivate *priv = notebook->priv;
 
   g_clear_object (&priv->gadget);
   g_clear_object (&priv->header_gadget);
   g_clear_object (&priv->tabs_gadget);
   g_clear_object (&priv->stack_gadget);
+
+  G_OBJECT_CLASS (gtk_notebook_parent_class)->finalize (object);
 }
 
 static void


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