console: avoid passing con=NULL to graphic_hw_update_done()
authorlichun <lichun@ruijie.com.cn>
Fri, 6 Nov 2020 17:03:39 +0000 (01:03 +0800)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 13 Nov 2020 06:36:33 +0000 (07:36 +0100)
In graphic_hw_update(), first select an existing console,
a specific-console or active_console(if not specified),
then updating the console.

Signed-off-by: lichun <lichun@ruijie.com.cn>
Message-id: 1604682219-114389-1-git-send-email-lichun@ruijie.com.cn
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/console.c

index e8e59707d38c0c08d597d6d90bda2e344936b5df..e07d2c380df75f84f6cb6c6b7f1f80bf9e3f9951 100644 (file)
@@ -270,10 +270,11 @@ void graphic_hw_update_done(QemuConsole *con)
 void graphic_hw_update(QemuConsole *con)
 {
     bool async = false;
+    con = con ? con : active_console;
     if (!con) {
-        con = active_console;
+        return;
     }
-    if (con && con->hw_ops->gfx_update) {
+    if (con->hw_ops->gfx_update) {
         con->hw_ops->gfx_update(con->hw);
         async = con->hw_ops->gfx_update_async;
     }