summary refs log tree commit diff stats
path: root/ui/gtk.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-09-15 15:28:31 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-10-03 15:09:57 +0400
commit9bd4d3df633593878ada3dffcfe05318754b4596 (patch)
treea00e7aa59555eda264120d455ece9ac886eeca1c /ui/gtk.c
parent75b773d84c89220463a14a6883d2b2a8e49e5b68 (diff)
downloadfocaccia-qemu-9bd4d3df633593878ada3dffcfe05318754b4596.tar.gz
focaccia-qemu-9bd4d3df633593878ada3dffcfe05318754b4596.zip
ui/gtk: fix UI info precondition
dpy_get_ui_info() shouldn't be called if the underlying GPU doesn't
support it.

Before the assert() was added and the regression introduced, GTK code
used to get "zero" UI info, for ex with a simple VGA device. The assert
was added to prevent from calling when there are no console too. The
other display backend that calls dpy_get_ui_info() correctly checks that
pre-condition.

Calling dpy_set_ui_info() is "safe" in this case, it will simply return
an error that can be generally ignored.

Fixes: commit a92e7bb4c ("ui: add precondition for dpy_get_ui_info()")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'ui/gtk.c')
-rw-r--r--ui/gtk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index cd3b8953cd..935de1209b 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -726,6 +726,10 @@ static void gd_set_ui_refresh_rate(VirtualConsole *vc, int refresh_rate)
 {
     QemuUIInfo info;
 
+    if (!dpy_ui_info_supported(vc->gfx.dcl.con)) {
+        return;
+    }
+
     info = *dpy_get_ui_info(vc->gfx.dcl.con);
     info.refresh_rate = refresh_rate;
     dpy_set_ui_info(vc->gfx.dcl.con, &info, true);
@@ -735,6 +739,10 @@ static void gd_set_ui_size(VirtualConsole *vc, gint width, gint height)
 {
     QemuUIInfo info;
 
+    if (!dpy_ui_info_supported(vc->gfx.dcl.con)) {
+        return;
+    }
+
     info = *dpy_get_ui_info(vc->gfx.dcl.con);
     info.width = width;
     info.height = height;