From patchwork Thu Aug 17 11:23:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoyi Tu X-Patchwork-Id: 13356277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0C22CC2FC0E for ; Thu, 17 Aug 2023 11:33:08 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWbEb-0001jy-BF; Thu, 17 Aug 2023 07:32:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWbEX-0001iS-5A for qemu-devel@nongnu.org; Thu, 17 Aug 2023 07:32:09 -0400 Received: from smtpnm6-02.21cn.com ([182.42.154.78] helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWbEU-0004v3-8l for qemu-devel@nongnu.org; Thu, 17 Aug 2023 07:32:08 -0400 HMM_SOURCE_IP: 192.168.139.44:35588.1307217768 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-36.111.64.85 (unknown [192.168.139.44]) by chinatelecom.cn (HERMES) with SMTP id 3E2061200C268; Thu, 17 Aug 2023 19:24:03 +0800 (CST) X-189-SAVE-TO-SEND: +tugy@chinatelecom.cn Received: from ([36.111.64.85]) by gateway-ssl-dep-56d86dc765-g96c8 with ESMTP id bf5ded637fe5494f94781e0db4b5782b for kraxel@redhat.com; Thu, 17 Aug 2023 19:24:05 CST X-Transaction-ID: bf5ded637fe5494f94781e0db4b5782b X-Real-From: tugy@chinatelecom.cn X-Receive-IP: 36.111.64.85 X-MEDUSA-Status: 0 From: tugy@chinatelecom.cn To: kraxel@redhat.com, marcandre.lureau@redhat.com Cc: qemu-devel@nongnu.org, tugy@chinatelecom.cn, dengpc12@chinatelecom.cn Subject: [PATCH 1/2] ui/vdagent: call vdagent_disconnect() when agent connection is lost Date: Thu, 17 Aug 2023 19:23:55 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=182.42.154.78; envelope-from=tugy@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guoyi Tu when the agent connection is lost, the input handler of the mouse doesn't deactivate, which results in unresponsive mouse events in VNC windows. To fix this issue, call vdagent_disconnect() to reset the state each time the frontend disconncect Signed-off-by: Guoyi Tu Signed-off-by: dengpengcheng --- ui/vdagent.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 8a651492f0..386dc5abe0 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -870,8 +870,11 @@ static void vdagent_disconnect(VDAgentChardev *vd) static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open) { + VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(chr); + if (!fe_open) { trace_vdagent_close(); + vdagent_disconnect(vd); /* To reset_serial, we CLOSED our side. Make sure the other end knows we * are ready again. */ qemu_chr_be_event(chr, CHR_EVENT_OPENED); @@ -922,7 +925,6 @@ static void vdagent_chr_fini(Object *obj) VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(obj); migrate_del_blocker(vd->migration_blocker); - vdagent_disconnect(vd); buffer_free(&vd->outbuf); error_free(vd->migration_blocker); }