[gtk/window-destroy: 7/16] colorchooserdialog: Fix disposing



commit bed3390fe7a82f68f2f9972d0bc5164ac78e9451
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 9 14:14:55 2020 -0400

    colorchooserdialog: Fix disposing
    
    We need to drop our widgetry in dispose to prevent
    leakage.

 gtk/gtkcolorchooserdialog.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/gtk/gtkcolorchooserdialog.c b/gtk/gtkcolorchooserdialog.c
index 4e3659c0e4..7e748400b7 100644
--- a/gtk/gtkcolorchooserdialog.c
+++ b/gtk/gtkcolorchooserdialog.c
@@ -191,12 +191,23 @@ gtk_color_chooser_dialog_set_property (GObject      *object,
     }
 }
 
+static void
+gtk_color_chooser_dialog_dispose (GObject *object)
+{
+  GtkColorChooserDialog *cc = GTK_COLOR_CHOOSER_DIALOG (object);
+
+  g_clear_pointer (&cc->chooser, gtk_widget_unparent);
+
+  G_OBJECT_CLASS (gtk_color_chooser_dialog_parent_class)->dispose (object);
+}
+
 static void
 gtk_color_chooser_dialog_class_init (GtkColorChooserDialogClass *class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (class);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
 
+  object_class->dispose = gtk_color_chooser_dialog_dispose;
   object_class->get_property = gtk_color_chooser_dialog_get_property;
   object_class->set_property = gtk_color_chooser_dialog_set_property;
 


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