#include #include #include gint main (gint argc, gchar * argv[]) { GladeXML *xml; int i; gtk_init (&argc, &argv); for (i=0; i<100; i++) { GtkWidget *w; printf ("Iteration %i\n", i); xml = glade_xml_new ("foo.glade", NULL, NULL); if (!xml) g_error ("Failed to load glade file\n"); w = glade_xml_get_widget (xml, "window1"); g_object_unref (G_OBJECT(xml)); /* Get rid of the XML for this iteration */ g_object_unref (w); /* Someone closes the window */ } return EXIT_SUCCESS; } /********************* Compiled with: gcc -g -o test test.c $(pkg-config --libs --cflags libglade-2.0 gtk+-2.0) ***************** Output: Iteration 0 (test:10496): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer (test:10496): GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed (test:10496): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer (test:10496): GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed Iteration 1 (test:10496): GLib-GObject-WARNING **: instance of invalid non-instantiatable type `' (test:10496): GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed (test:10496): GLib-GObject-WARNING **: instance of invalid non-instantiatable type `' (test:10496): GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed Iteration 2 Iteration 3 Iteration 4 Iteration 5 Iteration 6 Iteration 7 Iteration 8 Iteration 9 Iteration 10 Segmentation fault ************* Stack trace: #0 0xb7821da1 in g_slice_alloc () from /usr/lib/libglib-2.0.so.0 #1 0xb7821f5e in g_slice_alloc0 () from /usr/lib/libglib-2.0.so.0 #2 0xb7899f8c in g_type_create_instance () from /usr/lib/libgobject-2.0.so.0 #3 0xb7880aa2 in g_object_thaw_notify () from /usr/lib/libgobject-2.0.so.0 #4 0xb7881115 in g_object_newv () from /usr/lib/libgobject-2.0.so.0 #5 0xb7f47965 in glade_standard_build_widget () from /usr/lib/libglade-2.0.so.0 #6 0xb7f46e4a in glade_xml_build_widget () from /usr/lib/libglade-2.0.so.0 #7 0xb7f47029 in glade_xml_build_widget () from /usr/lib/libglade-2.0.so.0 #8 0xb7f4715d in glade_xml_construct () from /usr/lib/libglade-2.0.so.0 #9 0xb7f471d7 in glade_xml_new () from /usr/lib/libglade-2.0.so.0 #10 0x08048781 in main (argc=1, argv=0xbf97b1c4) at test.c:18 */