summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMorten Welinder <terra@gnome.org>2004-03-17 18:51:03 +0000
committerMorten Welinder <mortenw@src.gnome.org>2004-03-17 18:51:03 +0000
commitc25fece7667014146f5c274ce30e06a3f9e07b85 (patch)
tree1610e9d25264e4c27464b14322c7356d2640b4d6 /tests
parent3c20703bd764ebe46b77fcb0c29e5f85b7cb9d47 (diff)
downloadgtk+-c25fece7667014146f5c274ce30e06a3f9e07b85.tar.gz
Don't leak the tooltip object.
2004-03-17 Morten Welinder <terra@gnome.org> * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip object.
Diffstat (limited to 'tests')
-rw-r--r--tests/prop-editor.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/prop-editor.c b/tests/prop-editor.c
index 5d18c7d8ca..0dc055b3d9 100644
--- a/tests/prop-editor.c
+++ b/tests/prop-editor.c
@@ -772,6 +772,12 @@ properties_from_type (GObject *object,
return sw;
}
+static void
+kill_tips (GtkWindow *win, GtkObject *tips)
+{
+ gtk_object_destroy (tips);
+ g_object_unref (tips);
+}
/* Pass zero for type if you want all properties */
GtkWidget*
@@ -797,10 +803,13 @@ create_prop_editor (GObject *object,
if (GTK_IS_WIDGET (object))
gtk_window_set_screen (GTK_WINDOW (win),
gtk_widget_get_screen (GTK_WIDGET (object)));
-
+
tips = gtk_tooltips_new ();
- g_signal_connect_swapped (win, "destroy",
- G_CALLBACK (gtk_object_destroy), tips);
+ g_object_ref (tips);
+ gtk_object_sink (GTK_OBJECT (tips));
+
+ /* Kill the tips when the widget goes away. */
+ g_signal_connect (G_OBJECT (win), "destroy", G_CALLBACK (kill_tips), tips);
/* hold a weak ref to the object we're editing */
g_object_set_data_full (G_OBJECT (object), "prop-editor-win", win, model_destroy);