From: AlanoSong@163.com Date: Tue, 25 Nov 2025 13:19:55 +0000 (+0800) Subject: ui/vnc: Fix qemu abort when query vnc info X-Git-Tag: v10.2.0-rc2~6^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c1646e23f761e3dc6d88c8995f13be8f668a012;p=thirdparty%2Fqemu.git ui/vnc: Fix qemu abort when query vnc info 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 Signed-off-by: Alano Song [ Marc-André - removed useless Error *err ] Signed-off-by: Marc-André Lureau Message-ID: <20251125131955.7024-1-AlanoSong@163.com> --- 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);