Commit 1f0d194e39 for qemu.org
commit 1f0d194e39dfb064d0b9075986e0615235ada9fe
Author: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Date: Sun Sep 13 15:44:47 2026 +0900
ui/gtk: Work around the gtk-menu-bar-accel leak
The implementation of the gtk-menu-bar-accel property had a bug that
leaks memory when the set value is an empty string, which was fixed
with:
https://gitlab.gnome.org/GNOME/gtk/-/commit/44bf10c4a2a0463891884a105fa27cf36b73f119
To work around the issue for old GTK versions, replace the empty string
with NULL, which has the same meaning for the property.
Message-ID: <20260913-gtk-v1-1-3e4ac542e054@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
diff --git a/ui/gtk.c b/ui/gtk.c
index c615d35451..ae28f1fbb8 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -2645,7 +2645,7 @@ static void gd_create_menus(GtkDisplayState *s, DisplayOptions *opts)
/* Disable the default "F10" menu shortcut. */
settings = gtk_widget_get_settings(s->window);
- g_object_set(G_OBJECT(settings), "gtk-menu-bar-accel", "", NULL);
+ g_object_set(G_OBJECT(settings), "gtk-menu-bar-accel", NULL, NULL);
}