Skip to content

Commit

Permalink
ui/gtk: fix UI info precondition
Browse files Browse the repository at this point in the history
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 a92e7bb ("ui: add precondition for dpy_get_ui_info()")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
  • Loading branch information
elmarco committed Oct 3, 2023
1 parent 75b773d commit 9bd4d3d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ui/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 9bd4d3d

Please sign in to comment.