From 82877f9ee919f8a19060a219bfe5f94d8fa17f94 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 20 Jul 2004 17:10:24 +0000 Subject: Add some refcount debugging. 2004-07-20 Matthias Clasen * tests/testactions.c (main): * tests/testmerge.c (main): Add some refcount debugging. * gtk/gtkuimanager.c (update_node, free_node): Ref an sink all proxies, so that we can properly clean up floating proxies which the app didn't adopt. (#147926, Tommi Komulainen) --- tests/testactions.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'tests/testactions.c') diff --git a/tests/testactions.c b/tests/testactions.c index be8c78a28..3c9a50789 100644 --- a/tests/testactions.c +++ b/tests/testactions.c @@ -203,7 +203,12 @@ static const gchar *ui_info = " \n" " \n" " \n" -" \n"; +" \n" +" \n" +" \n" +" \n" +" \n" +" \n"; static void add_widget (GtkUIManager *merge, @@ -308,16 +313,18 @@ create_window (GtkActionGroup *action_group) GtkWidget *hbox, *spinbutton, *button; GError *error = NULL; + merge = gtk_ui_manager_new (); + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), -1, -1); gtk_window_set_title (GTK_WINDOW (window), "Action Test"); + g_signal_connect_swapped (window, "destroy", G_CALLBACK (g_object_unref), merge); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); box = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), box); gtk_widget_show (box); - merge = gtk_ui_manager_new (); gtk_ui_manager_insert_action_group (merge, action_group, 0); g_signal_connect (merge, "add_widget", G_CALLBACK (add_widget), box); @@ -382,6 +389,21 @@ main (int argc, char **argv) gtk_main (); +#ifdef DEBUG_UI_MANAGER + { + GList *action; + + for (action = gtk_action_group_list_actions (action_group); + action; + action = action->next) + { + GtkAction *a = action->data; + g_print ("action %s ref count %d\n", + gtk_action_get_name (a), G_OBJECT (a)->ref_count); + } + } +#endif + g_object_unref (action_group); gtk_accel_map_save ("accels"); -- cgit v1.2.1