[gtk+/gtk-3-22] shortcutsgroup: fix leak of title



commit 4100a848a7a92b7e5386bac814f9f42015a153d1
Author: Alan Jenkins <alan christopher jenkins gmail com>
Date:   Wed Oct 12 16:16:57 2016 +0100

    shortcutsgroup: fix leak of title
    
    like previous commit, albeit simpler this time
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772859

 gtk/gtkshortcutsgroup.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkshortcutsgroup.c b/gtk/gtkshortcutsgroup.c
index 9e92715..2ea98e8 100644
--- a/gtk/gtkshortcutsgroup.c
+++ b/gtk/gtkshortcutsgroup.c
@@ -266,6 +266,24 @@ gtk_shortcuts_group_finalize (GObject *object)
 }
 
 static void
+gtk_shortcuts_group_dispose (GObject *object)
+{
+  GtkShortcutsGroup *self = GTK_SHORTCUTS_GROUP (object);
+
+  /*
+   * Since we overload forall(), the inherited destroy() won't work as normal.
+   * Remove internal widgets ourself.
+   */
+  if (self->title)
+    {
+      gtk_widget_destroy (GTK_WIDGET (self->title));
+      self->title = NULL;
+    }
+
+  G_OBJECT_CLASS (gtk_shortcuts_group_parent_class)->dispose (object);
+}
+
+static void
 gtk_shortcuts_group_class_init (GtkShortcutsGroupClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -275,6 +293,7 @@ gtk_shortcuts_group_class_init (GtkShortcutsGroupClass *klass)
   object_class->finalize = gtk_shortcuts_group_finalize;
   object_class->get_property = gtk_shortcuts_group_get_property;
   object_class->set_property = gtk_shortcuts_group_set_property;
+  object_class->dispose = gtk_shortcuts_group_dispose;
 
   widget_class->direction_changed = gtk_shortcuts_group_direction_changed;
   container_class->add = gtk_shortcuts_group_add;


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