From 191558cfa41229403f5af2568b55f9cc5a9c4fea Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 4 Dec 2021 22:16:01 -0500 Subject: [PATCH] gtk-demo: Small fixup to the cursors demo --- demos/gtk-demo/cursors.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/demos/gtk-demo/cursors.c b/demos/gtk-demo/cursors.c index d1ea0314e5..31d935d813 100644 --- a/demos/gtk-demo/cursors.c +++ b/demos/gtk-demo/cursors.c @@ -24,6 +24,7 @@ do_cursors (GtkWidget *do_widget) builder = gtk_builder_new_from_resource ("/cursors/cursors.ui"); window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); + g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); g_signal_connect (window, "destroy", @@ -34,9 +35,7 @@ do_cursors (GtkWidget *do_widget) if (!gtk_widget_get_visible (window)) gtk_widget_show (window); else - { - gtk_window_destroy (GTK_WINDOW (window)); - } + gtk_window_destroy (GTK_WINDOW (window)); return window; }