]> Pileus Git - ~andy/gtk/commitdiff
Plug some leaks and expose others.
authorMorten Welinder <terra@gnome.org>
Wed, 17 Mar 2004 19:01:00 +0000 (19:01 +0000)
committerMorten Welinder <mortenw@src.gnome.org>
Wed, 17 Mar 2004 19:01:00 +0000 (19:01 +0000)
2004-03-17  Morten Welinder  <terra@gnome.org>

* tests/testfilechooser.c (main): Plug some leaks and expose
others.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
tests/testfilechooser.c

index 4cc7143c54869736c00dd5b89acd8809cbaefec7..13dfc5c3506fd2c44cabd103b803e2a8904ad449 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-03-17  Morten Welinder  <terra@gnome.org>
 
+       * tests/testfilechooser.c (main): Plug some leaks and expose
+       others.
+
        * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip
        object.  Fixed #136652.
 
index 4cc7143c54869736c00dd5b89acd8809cbaefec7..13dfc5c3506fd2c44cabd103b803e2a8904ad449 100644 (file)
@@ -1,5 +1,8 @@
 2004-03-17  Morten Welinder  <terra@gnome.org>
 
+       * tests/testfilechooser.c (main): Plug some leaks and expose
+       others.
+
        * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip
        object.  Fixed #136652.
 
index 4cc7143c54869736c00dd5b89acd8809cbaefec7..13dfc5c3506fd2c44cabd103b803e2a8904ad449 100644 (file)
@@ -1,5 +1,8 @@
 2004-03-17  Morten Welinder  <terra@gnome.org>
 
+       * tests/testfilechooser.c (main): Plug some leaks and expose
+       others.
+
        * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip
        object.  Fixed #136652.
 
index 4cc7143c54869736c00dd5b89acd8809cbaefec7..13dfc5c3506fd2c44cabd103b803e2a8904ad449 100644 (file)
@@ -1,5 +1,8 @@
 2004-03-17  Morten Welinder  <terra@gnome.org>
 
+       * tests/testfilechooser.c (main): Plug some leaks and expose
+       others.
+
        * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip
        object.  Fixed #136652.
 
index 4cc7143c54869736c00dd5b89acd8809cbaefec7..13dfc5c3506fd2c44cabd103b803e2a8904ad449 100644 (file)
@@ -1,5 +1,8 @@
 2004-03-17  Morten Welinder  <terra@gnome.org>
 
+       * tests/testfilechooser.c (main): Plug some leaks and expose
+       others.
+
        * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip
        object.  Fixed #136652.
 
index 5c32627f888c347eaa1aa8b63538074118c1c50c..863a11cd5a9ae7515df81225218606a0d0a3f56e 100644 (file)
@@ -368,6 +368,13 @@ set_filename_existing_nonexistent_cb (GtkButton      *button,
   set_filename (chooser, "/usr/nonexistent");
 }
 
+static void
+kill_dependent (GtkWindow *win, GtkObject *dep)
+{
+  gtk_object_destroy (dep);
+  g_object_unref (dep);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -530,8 +537,18 @@ main (int argc, char **argv)
                    G_CALLBACK (set_filename_existing_nonexistent_cb), dialog);
 
   gtk_widget_show_all (control_window);
-  
+
+  g_object_ref (control_window);
+  g_signal_connect (G_OBJECT (dialog), "destroy",
+                   G_CALLBACK (kill_dependent), control_window);
+
+  /* We need to hold a ref until we have destroyed the widgets, just in case
+   * someone else destroys them.  We explicitly destroy windows to catch leaks.
+   */
+  g_object_ref (dialog);
   gtk_main ();
+  gtk_widget_destroy (dialog);
+  g_object_unref (dialog);
 
   return 0;
 }