mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-02 22:41:07 +00:00
ui/console: allocate ui_timer in QemuConsole
Although at this point only QemuGraphicConsole have hw_ops that implements ui_info() callback, it makes sense to keep the code in the base QemuConsole, to simplify conditions for the caller. As of now, the code didn't reach a NULL timer because dpy_set_ui_info() checks if dpy_ui_info_supported() (hw_ops->ui_info != NULL), which is false for text_console_ops. This is a bit fragile, let simply allocate and free the timer in the base class. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-26-marcandre.lureau@redhat.com>
This commit is contained in:
parent
7fa4b8041b
commit
cfde05d15b
1 changed files with 6 additions and 2 deletions
|
@ -197,6 +197,7 @@ static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl);
|
|||
static bool console_compatible_with(QemuConsole *con,
|
||||
DisplayChangeListener *dcl, Error **errp);
|
||||
static QemuConsole *qemu_graphic_console_lookup_unused(void);
|
||||
static void dpy_set_ui_info_timer(void *opaque);
|
||||
|
||||
static void gui_update(void *opaque)
|
||||
{
|
||||
|
@ -1334,6 +1335,9 @@ qemu_console_register(QemuConsole *c)
|
|||
static void
|
||||
qemu_console_finalize(Object *obj)
|
||||
{
|
||||
QemuConsole *c = QEMU_CONSOLE(obj);
|
||||
|
||||
g_clear_pointer(&c->ui_timer, timer_free);
|
||||
/* TODO: should unregister from consoles and free itself */
|
||||
}
|
||||
|
||||
|
@ -1367,6 +1371,8 @@ qemu_console_init(Object *obj)
|
|||
qemu_co_queue_init(&c->dump_queue);
|
||||
c->ds = ds;
|
||||
c->window_id = -1;
|
||||
c->ui_timer = timer_new_ms(QEMU_CLOCK_REALTIME,
|
||||
dpy_set_ui_info_timer, c);
|
||||
qemu_console_register(c);
|
||||
}
|
||||
|
||||
|
@ -2193,8 +2199,6 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
|
|||
} else {
|
||||
trace_console_gfx_new();
|
||||
s = (QemuConsole *)object_new(TYPE_QEMU_GRAPHIC_CONSOLE);
|
||||
s->ui_timer = timer_new_ms(QEMU_CLOCK_REALTIME,
|
||||
dpy_set_ui_info_timer, s);
|
||||
}
|
||||
s->head = head;
|
||||
graphic_console_set_hwops(s, hw_ops, opaque);
|
||||
|
|
Loading…
Reference in a new issue