[gtk/nbpage: 5/21] assistant: Remove weak pointer in finalize



commit 3df4d1440a0a6a0db0800fc4136ef6f4e341a36c
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Feb 20 21:45:11 2019 -0500

    assistant: Remove weak pointer in finalize
    
    Otherwise, bad things can happen later, if
    somebody holds onto the list model.

 gtk/gtkassistant.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index 639e06e8b2..35e4ce021f 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -470,6 +470,18 @@ escape_cb (GtkAssistant *assistant)
   g_signal_stop_emission (assistant, signals[ESCAPE], 0);
 }
 
+static void
+gtk_assistant_finalize (GObject *object)
+{
+  GtkAssistant *assistant = GTK_ASSISTANT (object);
+  GtkAssistantPrivate *priv = assistant->priv;
+
+  if (priv->model)
+    g_object_remove_weak_pointer (G_OBJECT (priv->model), (gpointer *)&priv->model);
+
+  G_OBJECT_CLASS (gtk_assistant_parent_class)->finalize (object);
+}
+
 static void
 gtk_assistant_class_init (GtkAssistantClass *class)
 {
@@ -484,6 +496,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
   container_class = (GtkContainerClass *) class;
   window_class    = (GtkWindowClass *) class;
 
+  gobject_class->finalize = gtk_assistant_finalize;
   gobject_class->constructed  = gtk_assistant_constructed;
   gobject_class->set_property = gtk_assistant_set_property;
   gobject_class->get_property = gtk_assistant_get_property;


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