From 3ea258de2684ce83639b8fcebc7b215c30eefa76 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 1 Dec 2017 06:05:07 +0100 Subject: tests: Don't crash if widgets go away before clipboard Don't g_signal_connect() to the clipboard without protection - the clipboard might outlast you and still emit signals. --- tests/testclipboard2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/testclipboard2.c b/tests/testclipboard2.c index abc4751a30..cd72696f20 100644 --- a/tests/testclipboard2.c +++ b/tests/testclipboard2.c @@ -177,7 +177,7 @@ get_formats_list (GdkClipboard *clipboard) sw = gtk_scrolled_window_new (NULL, NULL); list = gtk_list_box_new (); - g_signal_connect (clipboard, "notify::formats", G_CALLBACK (clipboard_formats_change_cb), list); + g_signal_connect_object (clipboard, "notify::formats", G_CALLBACK (clipboard_formats_change_cb), list, 0); clipboard_formats_change_cb (clipboard, NULL, list); gtk_container_add (GTK_CONTAINER (sw), list); @@ -193,7 +193,7 @@ get_contents_widget (GdkClipboard *clipboard) gtk_widget_set_hexpand (stack, TRUE); gtk_widget_set_vexpand (stack, TRUE); g_signal_connect (stack, "notify::visible-child", G_CALLBACK (visible_child_changed_cb), clipboard); - g_signal_connect (clipboard, "changed", G_CALLBACK (clipboard_changed_cb), stack); + g_signal_connect_object (clipboard, "changed", G_CALLBACK (clipboard_changed_cb), stack, 0); child = get_formats_list (clipboard); gtk_stack_add_titled (GTK_STACK (stack), child, "info", "Info"); -- cgit v1.2.1