summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2017-12-01 06:05:07 +0100
committerBenjamin Otte <otte@redhat.com>2017-12-03 05:46:48 +0100
commit3ea258de2684ce83639b8fcebc7b215c30eefa76 (patch)
treead3ed09461fb3705e69d6c4a40d1647099a8b7b2 /tests
parentea1879396596f0aefb05b59c0d209a2716d61c42 (diff)
downloadgtk+-3ea258de2684ce83639b8fcebc7b215c30eefa76.tar.gz
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/testclipboard2.c4
1 files changed, 2 insertions, 2 deletions
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");