From deac44962a7e0cce423745d83173e5909c11cf61 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 12 Jun 2023 12:12:29 -0400 Subject: [PATCH] Fix a crash in gtk-demo Fixes #5889 --- demos/gtk-demo/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index 5957e751d3..20510b865f 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -314,13 +314,15 @@ display_images (const char *format, { char *resource_name; GtkWidget *box; + GtkWidget *image_label; resource_name = g_strconcat (resource_dir, "/", resources[i], NULL); - widget = display_image (NULL, resource_name, NULL); + image_label = gtk_label_new (resources[i]); + widget = display_image (NULL, resource_name, image_label); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_append (GTK_BOX (box), widget); - gtk_box_append (GTK_BOX (box), gtk_label_new (resources[i])); + gtk_box_append (GTK_BOX (box), image_label); gtk_flow_box_insert (GTK_FLOW_BOX (grid), box, -1); g_free (resource_name);