Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui/gtk: Fix gd_refresh_rate_millihz() when widget window is not realized
gtk_widget_get_window() returns NULL if the widget's window is not realized, and QEMU crashes. Example under gtk 3.22.30 (mate 1.20.1): qemu-system-x86_64: Gdk: gdk_window_get_origin: assertion 'GDK_IS_WINDOW (window)' failed (gdb) bt #0 0x00007ffff496cf70 in gdk_window_get_origin () from /usr/lib64/libgdk-3.so.0 qemu#1 0x00007ffff49582a0 in gdk_display_get_monitor_at_window () from /usr/lib64/libgdk-3.so.0 qemu#2 0x0000555555bb73e2 in gd_refresh_rate_millihz (window=0x5555579d6280) at ui/gtk.c:1973 qemu#3 gd_vc_gfx_init (view_menu=0x5555579f0590, group=0x0, idx=0, con=<optimized out>, vc=0x5555579d4a90, s=0x5555579d49f0) at ui/gtk.c:2048 qemu#4 gd_create_menu_view (s=0x5555579d49f0) at ui/gtk.c:2149 qemu#5 gd_create_menus (s=0x5555579d49f0) at ui/gtk.c:2188 qemu#6 gtk_display_init (ds=<optimized out>, opts=0x55555661ed80 <dpy>) at ui/gtk.c:2256 qemu#7 0x000055555583d5a0 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4358 Fixes: c4c0092 and 28b58f1 (display/gtk: get proper refreshrate) Reported-by: Jan Kiszka <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Tested-by: Jan Kiszka <[email protected]> Message-id: [email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
- Loading branch information