qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: richard.henderson@linaro.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"AlanoSong@163.com" <AlanoSong@163.com>
Subject: [PULL 4/4] ui/vnc: Fix qemu abort when query vnc info
Date: Tue, 25 Nov 2025 18:17:26 +0400	[thread overview]
Message-ID: <20251125141726.1755276-5-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20251125141726.1755276-1-marcandre.lureau@redhat.com>

From: "AlanoSong@163.com" <AlanoSong@163.com>

When there is no display device on qemu machine,
and user only access qemu by remote vnc.
At the same time user input `info vnc` by QMP,
the qemu will abort.

To avoid the abort above, I add display device check,
when query vnc info in qmp_query_vnc_servers().

Reviewed-by: Marc-AndréLureau <marcandre.lureau@redhat.com>
Signed-off-by: Alano Song <AlanoSong@163.com>
[ Marc-André - removed useless Error *err ]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20251125131955.7024-1-AlanoSong@163.com>
---
 ui/vnc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 0d499b208b..e6bcf0e1cf 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -556,9 +556,12 @@ VncInfo2List *qmp_query_vnc_servers(Error **errp)
         qmp_query_auth(vd->auth, vd->subauth, &info->auth,
                        &info->vencrypt, &info->has_vencrypt);
         if (vd->dcl.con) {
-            dev = DEVICE(object_property_get_link(OBJECT(vd->dcl.con),
-                                                  "device", &error_abort));
-            info->display = g_strdup(dev->id);
+            Object *obj = object_property_get_link(OBJECT(vd->dcl.con),
+                                                   "device", NULL);
+            if (obj) {
+                dev = DEVICE(obj);
+                info->display = g_strdup(dev->id);
+            }
         }
         if (vd->listener != NULL) {
             nsioc = qio_net_listener_nsioc(vd->listener);
-- 
2.51.1



  parent reply	other threads:[~2025-11-25 14:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25 14:17 [PULL 0/4] ui/chardev patches marcandre.lureau
2025-11-25 14:17 ` [PULL 1/4] ui/vdagent: fix windows agent regression marcandre.lureau
2025-11-25 14:17 ` [PULL 2/4] chardev/char-file: fix failure path marcandre.lureau
2025-11-25 14:17 ` [PULL 3/4] chardev/char-pty: Do not ignore chr_write() failures marcandre.lureau
2025-11-25 14:17 ` marcandre.lureau [this message]
2025-11-25 15:37   ` [PULL 4/4] ui/vnc: Fix qemu abort when query vnc info Philippe Mathieu-Daudé
2025-11-25 18:22 ` [PULL 0/4] ui/chardev patches Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251125141726.1755276-5-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=AlanoSong@163.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).