Skip to content
Snippets Groups Projects
Commit a92e7bb4 authored by Marc-André Lureau's avatar Marc-André Lureau
Browse files

ui: add precondition for dpy_get_ui_info()


Ensure that it only get called when dpy_ui_info_supported(). The
function should always return a result. There should be a non-null
console or active_console.

Modify the argument to be const as well.

Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarAlbert Esteve <aesteve@redhat.com>
parent 48a35e12
No related branches found
No related tags found
No related merge requests found
......@@ -329,7 +329,7 @@ void update_displaychangelistener(DisplayChangeListener *dcl,
uint64_t interval);
void unregister_displaychangelistener(DisplayChangeListener *dcl);
bool dpy_ui_info_supported(QemuConsole *con);
bool dpy_ui_info_supported(const QemuConsole *con);
const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con);
int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info, bool delay);
......
......@@ -801,7 +801,7 @@ static void dpy_set_ui_info_timer(void *opaque)
con->hw_ops->ui_info(con->hw, head, &con->ui_info);
}
bool dpy_ui_info_supported(QemuConsole *con)
bool dpy_ui_info_supported(const QemuConsole *con)
{
if (con == NULL) {
con = active_console;
......@@ -815,6 +815,8 @@ bool dpy_ui_info_supported(QemuConsole *con)
const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con)
{
assert(dpy_ui_info_supported(con));
if (con == NULL) {
con = active_console;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment