From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162685741169885.94243140587969; Wed, 21 Jul 2021 01:50:11 -0700 (PDT) Received: from localhost ([::1]:47112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67ve-0006Uh-Jd for importer@patchew.org; Wed, 21 Jul 2021 04:50:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67nl-0006NV-56 for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67nj-0004om-Gw for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:00 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-343--f39LDSmNV-Jd2VH86UtXQ-1; Wed, 21 Jul 2021 04:41:57 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C916E193579C for ; Wed, 21 Jul 2021 08:41:56 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EAAD83060; Wed, 21 Jul 2021 08:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tLQ60TpbJE+zchmjajoumonlNRDrN6jigUuEHNUzb9c=; b=TjMpspXPrQVW1otqMVoMX8UcuJGncuEDeNO803w3fNnZc0cnFuvj5KT3tiNEUuPjhqCkTN 2idUVE16w1XXF1e3VaQdBS/1fkaaJp9kJvn9oaEjrNrYIG/hAntCZ9WRG1yCkKrX1xmY64 n3wS4sZspS8gaZ4DLwhmsZTNluHy/IM= X-MC-Unique: -f39LDSmNV-Jd2VH86UtXQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 01/13] ui/vdagent: fix leak on error path Date: Wed, 21 Jul 2021 12:41:27 +0400 Message-Id: <20210721084139.1124779-2-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857412776100001 From: Marc-Andr=C3=A9 Lureau "info" was leaked when more than 10 entries. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/clipboard.h | 2 ++ ui/vdagent.c | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h index b45b984c9f..eb789a285a 100644 --- a/include/ui/clipboard.h +++ b/include/ui/clipboard.h @@ -190,4 +190,6 @@ void qemu_clipboard_set_data(QemuClipboardPeer *peer, const void *data, bool update); =20 +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuClipboardInfo, qemu_clipboard_info_unref) + #endif /* QEMU_CLIPBOARD_H */ diff --git a/ui/vdagent.c b/ui/vdagent.c index a253a8fe63..f6ef8d1993 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -438,7 +438,7 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *= vd, VDAgentMessage *msg) uint8_t s =3D VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD; uint32_t size =3D msg->size; void *data =3D msg->data; - QemuClipboardInfo *info; + g_autoptr(QemuClipboardInfo) info =3D NULL; QemuClipboardType type; =20 if (have_selection(vd)) { @@ -477,7 +477,6 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *= vd, VDAgentMessage *msg) size -=3D sizeof(uint32_t); } qemu_clipboard_update(info); - qemu_clipboard_info_unref(info); break; case VD_AGENT_CLIPBOARD_REQUEST: if (size < sizeof(uint32_t)) { @@ -523,7 +522,6 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *= vd, VDAgentMessage *msg) /* set empty clipboard info */ info =3D qemu_clipboard_info_new(NULL, s); qemu_clipboard_update(info); - qemu_clipboard_info_unref(info); } break; } --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857012839455.07230885380693; Wed, 21 Jul 2021 01:43:32 -0700 (PDT) Received: from localhost ([::1]:54754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67pD-0001CS-Pd for importer@patchew.org; Wed, 21 Jul 2021 04:43:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67nv-0006oC-FW for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67ns-0004xn-Cu for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:11 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-6pBtdoSlPiW5tk_0ZXvxww-1; Wed, 21 Jul 2021 04:42:04 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47FF5107B032 for ; Wed, 21 Jul 2021 08:42:02 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0C315D9DC; Wed, 21 Jul 2021 08:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cVjLzHO2nIi8KZy1mMtpuvGp6gSulIYAEN+AKOrF24Y=; b=SHWGk1o8J4RxvruP1yM4SyaUGWiSJM01KFEDUKfB7Z+5cGjJsRgqAVOR9CCY+DMs8kZd6I Q6EDGl/kEQdH3i6EPaidbJe+zkgk0W1Uryqw74Fyq+XcESiuAvBDYIMSQfEnSqpdlaUoZj ASxabw0JBpY35xzC8gPNz1wAxIhOxv4= X-MC-Unique: 6pBtdoSlPiW5tk_0ZXvxww-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 02/13] ui/vdagent: remove copy-pasta comment Date: Wed, 21 Jul 2021 12:41:28 +0400 Message-Id: <20210721084139.1124779-3-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857014800100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/vdagent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index f6ef8d1993..5ae5734c81 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -516,7 +516,7 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *= vd, VDAgentMessage *msg) qemu_clipboard_set_data(&vd->cbpeer, vd->cbinfo[s], type, size, data, true); break; - case VD_AGENT_CLIPBOARD_RELEASE: /* data */ + case VD_AGENT_CLIPBOARD_RELEASE: if (vd->cbinfo[s] && vd->cbinfo[s]->owner =3D=3D &vd->cbpeer) { /* set empty clipboard info */ --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857565818977.5359843385834; Wed, 21 Jul 2021 01:52:45 -0700 (PDT) Received: from localhost ([::1]:52316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67y8-0001sv-Qp for importer@patchew.org; Wed, 21 Jul 2021 04:52:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67nw-0006oY-KR for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67nt-0004yB-23 for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:12 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-CwRAEkuYP-Ww9NdqcI6YaA-1; Wed, 21 Jul 2021 04:42:07 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 774A410150B6 for ; Wed, 21 Jul 2021 08:42:06 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9AEC45D9FC; Wed, 21 Jul 2021 08:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bykDuWmowo5cwOmADbmeEKqhIej2kqyYevtwCdn4GsY=; b=Nmp1irjytBrm9LaNrGqbZ6RzICUaGkUTm/FHOMfbgs3aJSejRmcZQ0vHnc+O8Fs0F4DxZx qg1HidYVj4wwtaI1I8kABuW+YgMmA5A5dD3TWSAsIEW2+sHOJ5lfGCkyRw6r0mKtSx944F rmhLRo9G5rVZx+d6NfGLPxz0SVcRKCA= X-MC-Unique: CwRAEkuYP-Ww9NdqcI6YaA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 03/13] ui/gtk-clipboard: use existing macros Date: Wed, 21 Jul 2021 12:41:29 +0400 Message-Id: <20210721084139.1124779-4-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857567521100001 From: Marc-Andr=C3=A9 Lureau Hardcoding strings is error prone, use dedicated macros instead. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/gtk-clipboard.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index bff28d2030..5e817ae55c 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -177,11 +177,11 @@ void gd_clipboard_init(GtkDisplayState *gd) qemu_clipboard_peer_register(&gd->cbpeer); =20 gd->gtkcb[QEMU_CLIPBOARD_SELECTION_CLIPBOARD] =3D - gtk_clipboard_get(gdk_atom_intern("CLIPBOARD", FALSE)); + gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gd->gtkcb[QEMU_CLIPBOARD_SELECTION_PRIMARY] =3D - gtk_clipboard_get(gdk_atom_intern("PRIMARY", FALSE)); + gtk_clipboard_get(GDK_SELECTION_PRIMARY); gd->gtkcb[QEMU_CLIPBOARD_SELECTION_SECONDARY] =3D - gtk_clipboard_get(gdk_atom_intern("SECONDARY", FALSE)); + gtk_clipboard_get(GDK_SELECTION_SECONDARY); =20 g_signal_connect(gd->gtkcb[QEMU_CLIPBOARD_SELECTION_CLIPBOARD], "owner-change", G_CALLBACK(gd_owner_change), gd); --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857038690114.99240585038308; Wed, 21 Jul 2021 01:43:58 -0700 (PDT) Received: from localhost ([::1]:55934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67pd-0001yr-LC for importer@patchew.org; Wed, 21 Jul 2021 04:43:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67o0-0006tV-FE for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67ny-00052D-VX for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:16 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-49-sNdo5nNqMLuOGoVknbMuIw-1; Wed, 21 Jul 2021 04:42:12 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 484A5845F2C for ; Wed, 21 Jul 2021 08:42:11 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38F8619D7C; Wed, 21 Jul 2021 08:42:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h8DWW4GTGc5bGckpzifXOx+F24qr9GjY3WY4ez/Gmhc=; b=cL2dRBTzoB9x67WNBXYoKLx67+ZDwAEAleH7qKU6ESL/1HQJN25hlc7lrVnyhb9C4uoVfx IVWbUyA30MxMOctz8+qouq0v4PgEoW3dwzgrDbVPc9n2vfeiwbzTKId3DqLbE5u1H4xMUH sDKGZznR7n3MlhfZsUtgSuNjaajWXyg= X-MC-Unique: sNdo5nNqMLuOGoVknbMuIw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 04/13] ui/gtk-clipboard: fix clipboard enum typo Date: Wed, 21 Jul 2021 12:41:30 +0400 Message-Id: <20210721084139.1124779-5-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857040115100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/gtk-clipboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index 5e817ae55c..2c78de9500 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -155,7 +155,7 @@ static void gd_owner_change(GtkClipboard *clipboard, =20 =20 switch (event->owner_change.reason) { - case GDK_SETTING_ACTION_NEW: + case GDK_OWNER_CHANGE_NEW_OWNER: info =3D qemu_clipboard_info_new(&gd->cbpeer, s); if (gtk_clipboard_wait_is_text_available(clipboard)) { info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true; --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857020448272.21277475804266; Wed, 21 Jul 2021 01:43:40 -0700 (PDT) Received: from localhost ([::1]:55520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67pL-0001hp-Cg for importer@patchew.org; Wed, 21 Jul 2021 04:43:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67o5-00070Q-9w for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67o2-00055X-DH for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-589-RBRLJk3dNYWQIEp_u5N5NQ-1; Wed, 21 Jul 2021 04:42:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CF901030C20 for ; Wed, 21 Jul 2021 08:42:15 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B71E119811; Wed, 21 Jul 2021 08:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856937; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uxVivlhdggH8hSzuvkWSXHFxbgrHJy6pB7yNHHuxKRs=; b=Gz1i4iBu/OsL4H83r8quAuQ4AQ4k21wgY9A6PxQ7H3tm4sbQfiToKjdBm4O1bwa0fg62JB gNuua3WMrw1rqAhkGx1NwaS13/6lUsZnHkfb1Rp8vqZwLXlXoN90jPA2JqcUtzKTWAtoEX BP9kIIWK3Iux0dvPqXaoj3HPnh96LgE= X-MC-Unique: RBRLJk3dNYWQIEp_u5N5NQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 05/13] ui/clipboard: add helper to retrieve current clipboard Date: Wed, 21 Jul 2021 12:41:31 +0400 Message-Id: <20210721084139.1124779-6-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857021020100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/clipboard.h | 9 +++++++++ ui/clipboard.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h index eb789a285a..e9fcb15c66 100644 --- a/include/ui/clipboard.h +++ b/include/ui/clipboard.h @@ -109,6 +109,15 @@ void qemu_clipboard_peer_register(QemuClipboardPeer *p= eer); */ void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer); =20 +/** + * qemu_clipboard_info + * + * @selection: clipboard selection. + * + * Return the current clipboard data & owner informations. + */ +QemuClipboardInfo *qemu_clipboard_info(QemuClipboardSelection selection); + /** * qemu_clipboard_info_new * diff --git a/ui/clipboard.c b/ui/clipboard.c index 3525b30178..56c14509fe 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -4,6 +4,8 @@ static NotifierList clipboard_notifiers =3D NOTIFIER_LIST_INITIALIZER(clipboard_notifiers); =20 +static QemuClipboardInfo *cbinfo[QEMU_CLIPBOARD_SELECTION__COUNT]; + void qemu_clipboard_peer_register(QemuClipboardPeer *peer) { notifier_list_add(&clipboard_notifiers, &peer->update); @@ -16,7 +18,20 @@ void qemu_clipboard_peer_unregister(QemuClipboardPeer *p= eer) =20 void qemu_clipboard_update(QemuClipboardInfo *info) { + g_autoptr(QemuClipboardInfo) old =3D NULL; + assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT); + notifier_list_notify(&clipboard_notifiers, info); + + old =3D cbinfo[info->selection]; + cbinfo[info->selection] =3D qemu_clipboard_info_ref(info); +} + +QemuClipboardInfo *qemu_clipboard_info(QemuClipboardSelection selection) +{ + assert(selection < QEMU_CLIPBOARD_SELECTION__COUNT); + + return cbinfo[selection]; } =20 QemuClipboardInfo *qemu_clipboard_info_new(QemuClipboardPeer *owner, --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857194560815.1134832361474; Wed, 21 Jul 2021 01:46:34 -0700 (PDT) Received: from localhost ([::1]:36214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67s9-0007hH-BJ for importer@patchew.org; Wed, 21 Jul 2021 04:46:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67o8-00074H-OY for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53183) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67o7-00059W-81 for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:24 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-fVpS4jcAOxKiQuHcFFcytA-1; Wed, 21 Jul 2021 04:42:21 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7068A873079 for ; Wed, 21 Jul 2021 08:42:20 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 824935D9FC; Wed, 21 Jul 2021 08:42:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pp+7qQuM/5UkNDkITrrbNiBeKGS9spJa0q99oABY188=; b=ahlA7xRFktj8e1ElvkBPlMI6I5FGODgUSzc0siXmFFqQj6Go83N4y2KsTwIluSuzb1OP4B GKafkt0m2RgzvAvqr0R0DYQBcOxzAyffUZHc153SndByWLPvqSDQJy669+Ho5m6AL9FNr3 UwDLXRQXhFgSXr1U/QZkRCUJbF4pPWA= X-MC-Unique: fVpS4jcAOxKiQuHcFFcytA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 06/13] ui/clipboard: release owned grabs on unregister Date: Wed, 21 Jul 2021 12:41:32 +0400 Message-Id: <20210721084139.1124779-7-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857195315100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/clipboard.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/clipboard.c b/ui/clipboard.c index 56c14509fe..a9512f01a7 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -13,6 +13,15 @@ void qemu_clipboard_peer_register(QemuClipboardPeer *pee= r) =20 void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer) { + int i; + + for (i =3D 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) { + if (cbinfo[i] && cbinfo[i]->owner =3D=3D peer) { + /* release owned grabs */ + g_autoptr(QemuClipboardInfo) info =3D qemu_clipboard_info_new(= NULL, i); + qemu_clipboard_update(info); + } + } notifier_remove(&peer->update); } =20 --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857664848577.2106103001289; Wed, 21 Jul 2021 01:54:24 -0700 (PDT) Received: from localhost ([::1]:56056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67zj-0004Nv-MW for importer@patchew.org; Wed, 21 Jul 2021 04:54:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67rp-0008Hf-8t for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:46:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67rn-00084s-QV for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:46:13 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-FFzeuJS7NdSLcT_Hqrioog-1; Wed, 21 Jul 2021 04:42:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B5816800D62 for ; Wed, 21 Jul 2021 08:42:31 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7A8E84A16; Wed, 21 Jul 2021 08:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626857171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=THZGEmL1ON3sOCgaZq2CNcN8xwiiSAihcDMZ4EzEkSY=; b=cGOMshOrrq6ipchGznp0cPQq736syefRqGqsvFaIGGZumTLz9kbrI38lKcHmvOOhhC1VYx 4/HmkwetwncKGB8TLgdpLzl/voX7roK6wvpk1yIpFvDiHa4cRvWbX3rvVDYnZc6TxmWj3Q mm7TbBoAGD9MN0aYUMNIBP9NLTexCbU= X-MC-Unique: FFzeuJS7NdSLcT_Hqrioog-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 07/13] ui/vdagent: disconnect handlers and reset state on finalize Date: Wed, 21 Jul 2021 12:41:33 +0400 Message-Id: <20210721084139.1124779-8-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857665224100001 From: Marc-Andr=C3=A9 Lureau Avoid handlers being called with dangling pointers when the object is freed. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/vdagent.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 5ae5734c81..1a29016e07 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -721,22 +721,26 @@ static void vdagent_chr_accept_input(Chardev *chr) vdagent_send_buf(vd); } =20 +static void vdagent_disconnect(VDAgentChardev *vd) +{ + vdagent_reset_bufs(vd); + vd->caps =3D 0; + if (vd->mouse_hs) { + qemu_input_handler_deactivate(vd->mouse_hs); + } + if (vd->cbpeer.update.notify) { + qemu_clipboard_peer_unregister(&vd->cbpeer); + memset(&vd->cbpeer, 0, sizeof(vd->cbpeer)); + } +} + static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open) { VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(chr); =20 if (!fe_open) { trace_vdagent_close(); - /* reset state */ - vdagent_reset_bufs(vd); - vd->caps =3D 0; - if (vd->mouse_hs) { - qemu_input_handler_deactivate(vd->mouse_hs); - } - if (vd->cbpeer.update.notify) { - qemu_clipboard_peer_unregister(&vd->cbpeer); - memset(&vd->cbpeer, 0, sizeof(vd->cbpeer)); - } + vdagent_disconnect(vd); return; } =20 @@ -781,6 +785,7 @@ static void vdagent_chr_fini(Object *obj) { VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(obj); =20 + vdagent_disconnect(vd); buffer_free(&vd->outbuf); } =20 --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857337802482.50257348913635; Wed, 21 Jul 2021 01:48:57 -0700 (PDT) Received: from localhost ([::1]:43784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67uS-0004IQ-Rp for importer@patchew.org; Wed, 21 Jul 2021 04:48:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67sk-0002Ds-7D for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:47:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55167) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67si-0000I7-PD for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:47:09 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-400-vNn1yKuMMEWipg6LbjwTyA-1; Wed, 21 Jul 2021 04:42:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EBA11023F5B for ; Wed, 21 Jul 2021 08:42:37 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id E417184A15; Wed, 21 Jul 2021 08:42:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626857228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TUmFx9j8+LWbFJAKqUl0016kVaEt4yxP1wppqlyAezw=; b=fY5BDX4fHrUxwFyWm4NfOo7c+1OKuiLgeEQyZIIgSAJVuWvtp50tz5obF/j8poofE2APdR GHbd7DhQQWRr1xZUgjHpfsKkJx6E3OoljaVMVyQ4cFU27FDuZuo8/BciARKFtkwdUMNNSZ rgh7ekB9GBibNzFhSjadPr+mWjy76d4= X-MC-Unique: vNn1yKuMMEWipg6LbjwTyA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 08/13] ui/vdagent: reset outbuf on disconnect Date: Wed, 21 Jul 2021 12:41:34 +0400 Message-Id: <20210721084139.1124779-9-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857339214100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/vdagent.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/vdagent.c b/ui/vdagent.c index 1a29016e07..3770c58b6c 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -723,6 +723,7 @@ static void vdagent_chr_accept_input(Chardev *chr) =20 static void vdagent_disconnect(VDAgentChardev *vd) { + buffer_reset(&vd->outbuf); vdagent_reset_bufs(vd); vd->caps =3D 0; if (vd->mouse_hs) { --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162685733093823.33850884127787; Wed, 21 Jul 2021 01:48:50 -0700 (PDT) Received: from localhost ([::1]:43200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67uL-0003vE-So for importer@patchew.org; Wed, 21 Jul 2021 04:48:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67oU-0008MD-JL for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55781) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67oS-0005PJ-OZ for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-JEnbNlscNTapQgcyZUM20Q-1; Wed, 21 Jul 2021 04:42:42 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1112410150A0 for ; Wed, 21 Jul 2021 08:42:42 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4BEF19C79; Wed, 21 Jul 2021 08:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MiiLtG9jTgAfsEsTqsGDvXGbSys/7B0mP5opXs/AAH4=; b=PVZZ9rP8y2j8ywl50WvZPub/hTd19iJe8ANcgyryFHr4oAJK+w1x5sV6ggscGGtBC2Q9vd zvVXqeH5UyUsWsBkI1Z/Vj5z5ip+SJpVZyNyBOnq8qUtPMmszEllUi2T0X9BSgCcIsmg6c TUuuhlFB85mrPTBzsSlsU6c6rdttvqk= X-MC-Unique: JEnbNlscNTapQgcyZUM20Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 09/13] ui/vdagent: split clipboard recv message handling Date: Wed, 21 Jul 2021 12:41:35 +0400 Message-Id: <20210721084139.1124779-10-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857332931100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/vdagent.c | 157 +++++++++++++++++++++++++++++---------------------- 1 file changed, 89 insertions(+), 68 deletions(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 3770c58b6c..362064213c 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -433,13 +433,94 @@ static void vdagent_clipboard_request(QemuClipboardIn= fo *info, vdagent_send_msg(vd, msg); } =20 +static void vdagent_clipboard_recv_grab(VDAgentChardev *vd, uint8_t s, uin= t32_t size, void *data) +{ + g_autoptr(QemuClipboardInfo) info =3D NULL; + + trace_vdagent_cb_grab_selection(GET_NAME(sel_name, s)); + info =3D qemu_clipboard_info_new(&vd->cbpeer, s); + if (size > sizeof(uint32_t) * 10) { + /* + * spice has 6 types as of 2021. Limiting to 10 entries + * so we we have some wiggle room. + */ + return; + } + while (size >=3D sizeof(uint32_t)) { + trace_vdagent_cb_grab_type(GET_NAME(type_name, *(uint32_t *)data)); + switch (*(uint32_t *)data) { + case VD_AGENT_CLIPBOARD_UTF8_TEXT: + info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true; + break; + default: + break; + } + data +=3D sizeof(uint32_t); + size -=3D sizeof(uint32_t); + } + qemu_clipboard_update(info); +} + +static void vdagent_clipboard_recv_request(VDAgentChardev *vd, uint8_t s, = uint32_t size, void *data) +{ + QemuClipboardType type; + + if (size < sizeof(uint32_t)) { + return; + } + switch (*(uint32_t *)data) { + case VD_AGENT_CLIPBOARD_UTF8_TEXT: + type =3D QEMU_CLIPBOARD_TYPE_TEXT; + break; + default: + return; + } + if (vd->cbinfo[s] && vd->cbinfo[s]->types[type].available && + vd->cbinfo[s]->owner !=3D &vd->cbpeer) { + if (vd->cbinfo[s]->types[type].data) { + vdagent_send_clipboard_data(vd, vd->cbinfo[s], type); + } else { + vd->cbpending[s] |=3D (1 << type); + qemu_clipboard_request(vd->cbinfo[s], type); + } + } +} + +static void vdagent_clipboard_recv_data(VDAgentChardev *vd, uint8_t s, uin= t32_t size, void *data) +{ + QemuClipboardType type; + + if (size < sizeof(uint32_t)) { + return; + } + switch (*(uint32_t *)data) { + case VD_AGENT_CLIPBOARD_UTF8_TEXT: + type =3D QEMU_CLIPBOARD_TYPE_TEXT; + break; + default: + return; + } + data +=3D 4; + size -=3D 4; + qemu_clipboard_set_data(&vd->cbpeer, vd->cbinfo[s], type, size, data, = true); +} + +static void vdagent_clipboard_recv_release(VDAgentChardev *vd, uint8_t s) +{ + g_autoptr(QemuClipboardInfo) info =3D NULL; + + if (vd->cbinfo[s] && vd->cbinfo[s]->owner =3D=3D &vd->cbpeer) { + /* set empty clipboard info */ + info =3D qemu_clipboard_info_new(NULL, s); + qemu_clipboard_update(info); + } +} + static void vdagent_chr_recv_clipboard(VDAgentChardev *vd, VDAgentMessage = *msg) { uint8_t s =3D VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD; uint32_t size =3D msg->size; void *data =3D msg->data; - g_autoptr(QemuClipboardInfo) info =3D NULL; - QemuClipboardType type; =20 if (have_selection(vd)) { if (size < 4) { @@ -455,75 +536,15 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev= *vd, VDAgentMessage *msg) =20 switch (msg->type) { case VD_AGENT_CLIPBOARD_GRAB: - trace_vdagent_cb_grab_selection(GET_NAME(sel_name, s)); - info =3D qemu_clipboard_info_new(&vd->cbpeer, s); - if (size > sizeof(uint32_t) * 10) { - /* - * spice has 6 types as of 2021. Limiting to 10 entries - * so we we have some wiggle room. - */ - return; - } - while (size >=3D sizeof(uint32_t)) { - trace_vdagent_cb_grab_type(GET_NAME(type_name, *(uint32_t *)da= ta)); - switch (*(uint32_t *)data) { - case VD_AGENT_CLIPBOARD_UTF8_TEXT: - info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true; - break; - default: - break; - } - data +=3D sizeof(uint32_t); - size -=3D sizeof(uint32_t); - } - qemu_clipboard_update(info); - break; + return vdagent_clipboard_recv_grab(vd, s, size, data); case VD_AGENT_CLIPBOARD_REQUEST: - if (size < sizeof(uint32_t)) { - return; - } - switch (*(uint32_t *)data) { - case VD_AGENT_CLIPBOARD_UTF8_TEXT: - type =3D QEMU_CLIPBOARD_TYPE_TEXT; - break; - default: - return; - } - if (vd->cbinfo[s] && - vd->cbinfo[s]->types[type].available && - vd->cbinfo[s]->owner !=3D &vd->cbpeer) { - if (vd->cbinfo[s]->types[type].data) { - vdagent_send_clipboard_data(vd, vd->cbinfo[s], type); - } else { - vd->cbpending[s] |=3D (1 << type); - qemu_clipboard_request(vd->cbinfo[s], type); - } - } - break; + return vdagent_clipboard_recv_request(vd, s, size, data); case VD_AGENT_CLIPBOARD: /* data */ - if (size < sizeof(uint32_t)) { - return; - } - switch (*(uint32_t *)data) { - case VD_AGENT_CLIPBOARD_UTF8_TEXT: - type =3D QEMU_CLIPBOARD_TYPE_TEXT; - break; - default: - return; - } - data +=3D 4; - size -=3D 4; - qemu_clipboard_set_data(&vd->cbpeer, vd->cbinfo[s], type, - size, data, true); - break; + return vdagent_clipboard_recv_data(vd, s, size, data); case VD_AGENT_CLIPBOARD_RELEASE: - if (vd->cbinfo[s] && - vd->cbinfo[s]->owner =3D=3D &vd->cbpeer) { - /* set empty clipboard info */ - info =3D qemu_clipboard_info_new(NULL, s); - qemu_clipboard_update(info); - } - break; + return vdagent_clipboard_recv_release(vd, s); + default: + g_assert_not_reached(); } } =20 --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162685718957999.94939250879224; Wed, 21 Jul 2021 01:46:29 -0700 (PDT) Received: from localhost ([::1]:35828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67s4-0007Qq-FY for importer@patchew.org; Wed, 21 Jul 2021 04:46:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67og-0000jF-Qk for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56327) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67of-0005ZU-1W for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:42:58 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-500-XhPJw0WnNGqcwbppEGF5WA-1; Wed, 21 Jul 2021 04:42:54 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0BD1A1853028 for ; Wed, 21 Jul 2021 08:42:54 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0946660BF1; Wed, 21 Jul 2021 08:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FXHbR8nJJ0NV3kvnIW/1qe5jkVQkig7Pf2ODI1q+N9o=; b=gGxpVzT98EdvFezPjcBVIBrzPYlTBCcG9yl8kQv7ulmF7015/OLzWrF6UXH34oVy3rQmbW Q6UENyHOwyNswQAEdrBS0RmNpfmZg83YEKGdI6eMvNUJNlPK5p674kKGbkIY/R8UOu03Yj JiVcO2JLiYfTb1WyPpmRXrXNA80+sik= X-MC-Unique: XhPJw0WnNGqcwbppEGF5WA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 10/13] ui/vdagent: use qemu_clipboard_info helper Date: Wed, 21 Jul 2021 12:41:36 +0400 Message-Id: <20210721084139.1124779-11-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857191108100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/vdagent.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 362064213c..bc8347f995 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -47,7 +47,6 @@ struct VDAgentChardev { =20 /* clipboard */ QemuClipboardPeer cbpeer; - QemuClipboardInfo *cbinfo[QEMU_CLIPBOARD_SELECTION__COUNT]; uint32_t cbpending[QEMU_CLIPBOARD_SELECTION__COUNT]; }; typedef struct VDAgentChardev VDAgentChardev; @@ -384,9 +383,7 @@ static void vdagent_clipboard_notify(Notifier *notifier= , void *data) QemuClipboardType type; bool self_update =3D info->owner =3D=3D &vd->cbpeer; =20 - if (info !=3D vd->cbinfo[s]) { - qemu_clipboard_info_unref(vd->cbinfo[s]); - vd->cbinfo[s] =3D qemu_clipboard_info_ref(info); + if (info !=3D qemu_clipboard_info(s)) { vd->cbpending[s] =3D 0; if (!self_update) { vdagent_send_clipboard_grab(vd, info); @@ -464,6 +461,7 @@ static void vdagent_clipboard_recv_grab(VDAgentChardev = *vd, uint8_t s, uint32_t static void vdagent_clipboard_recv_request(VDAgentChardev *vd, uint8_t s, = uint32_t size, void *data) { QemuClipboardType type; + QemuClipboardInfo *info; =20 if (size < sizeof(uint32_t)) { return; @@ -475,13 +473,14 @@ static void vdagent_clipboard_recv_request(VDAgentCha= rdev *vd, uint8_t s, uint32 default: return; } - if (vd->cbinfo[s] && vd->cbinfo[s]->types[type].available && - vd->cbinfo[s]->owner !=3D &vd->cbpeer) { - if (vd->cbinfo[s]->types[type].data) { - vdagent_send_clipboard_data(vd, vd->cbinfo[s], type); + + info =3D qemu_clipboard_info(s); + if (info && info->types[type].available && info->owner !=3D &vd->cbpee= r) { + if (info->types[type].data) { + vdagent_send_clipboard_data(vd, info, type); } else { vd->cbpending[s] |=3D (1 << type); - qemu_clipboard_request(vd->cbinfo[s], type); + qemu_clipboard_request(info, type); } } } @@ -489,6 +488,7 @@ static void vdagent_clipboard_recv_request(VDAgentChard= ev *vd, uint8_t s, uint32 static void vdagent_clipboard_recv_data(VDAgentChardev *vd, uint8_t s, uin= t32_t size, void *data) { QemuClipboardType type; + QemuClipboardInfo *info; =20 if (size < sizeof(uint32_t)) { return; @@ -502,14 +502,20 @@ static void vdagent_clipboard_recv_data(VDAgentCharde= v *vd, uint8_t s, uint32_t } data +=3D 4; size -=3D 4; - qemu_clipboard_set_data(&vd->cbpeer, vd->cbinfo[s], type, size, data, = true); + + info =3D qemu_clipboard_info(s); + if (info->owner =3D=3D &vd->cbpeer) { + qemu_clipboard_set_data(&vd->cbpeer, info, type, size, data, true); + } } =20 static void vdagent_clipboard_recv_release(VDAgentChardev *vd, uint8_t s) { + QemuClipboardInfo *cur; g_autoptr(QemuClipboardInfo) info =3D NULL; =20 - if (vd->cbinfo[s] && vd->cbinfo[s]->owner =3D=3D &vd->cbpeer) { + cur =3D qemu_clipboard_info(s); + if (cur && cur->owner =3D=3D &vd->cbpeer) { /* set empty clipboard info */ info =3D qemu_clipboard_info_new(NULL, s); qemu_clipboard_update(info); --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857682018704.5561004822839; Wed, 21 Jul 2021 01:54:42 -0700 (PDT) Received: from localhost ([::1]:57338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6800-0005FE-VQ for importer@patchew.org; Wed, 21 Jul 2021 04:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67ol-000115-FX for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:43:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22253) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67oj-0005ct-N8 for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:43:03 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-U0PKzoMkOGG8BHMi0kn1Kg-1; Wed, 21 Jul 2021 04:42:59 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DDAA210150A5 for ; Wed, 21 Jul 2021 08:42:58 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F9C160BF1; Wed, 21 Jul 2021 08:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j9c83z6wiL8GF/bT0bHj/Ul4bxjF1Y2+EXIDB94Ucig=; b=TccvDifWnADPCsKBn1+j79QyaEaXGgLmTahyWL3YhrN7Sobr/1Ux/BhG8INwyhgQIiPHHr PWB1UHZO3KBoFnzVmcJ8B9SYo/gH3/35MK5Y3vUzK+ZjamFtJ5Xkt3ST9YyJryeDi6Mvxg FZpjI2Rz/22qNAl4WGIUXAYNxkoskIU= X-MC-Unique: U0PKzoMkOGG8BHMi0kn1Kg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 11/13] ui/gtk-clipboard: use qemu_clipboard_info helper Date: Wed, 21 Jul 2021 12:41:37 +0400 Message-Id: <20210721084139.1124779-12-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857682220100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/gtk.h | 1 - ui/gtk-clipboard.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 9516670ebc..60e9cdc39c 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -139,7 +139,6 @@ struct GtkDisplayState { bool external_pause_update; =20 QemuClipboardPeer cbpeer; - QemuClipboardInfo *cbinfo[QEMU_CLIPBOARD_SELECTION__COUNT]; uint32_t cbpending[QEMU_CLIPBOARD_SELECTION__COUNT]; GtkClipboard *gtkcb[QEMU_CLIPBOARD_SELECTION__COUNT]; bool cbowner[QEMU_CLIPBOARD_SELECTION__COUNT]; diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index 2c78de9500..4e4b3c52bb 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -45,24 +45,24 @@ static void gd_clipboard_get_data(GtkClipboard *cli= pboard, GtkDisplayState *gd =3D data; QemuClipboardSelection s =3D gd_find_selection(gd, clipboard); QemuClipboardType type =3D QEMU_CLIPBOARD_TYPE_TEXT; - QemuClipboardInfo *info =3D qemu_clipboard_info_ref(gd->cbinfo[s]); + g_autoptr(QemuClipboardInfo) info =3D NULL; + + info =3D qemu_clipboard_info_ref(qemu_clipboard_info(s)); =20 qemu_clipboard_request(info, type); - while (info =3D=3D gd->cbinfo[s] && + while (info =3D=3D qemu_clipboard_info(s) && info->types[type].available && info->types[type].data =3D=3D NULL) { main_loop_wait(false); } =20 - if (info =3D=3D gd->cbinfo[s] && gd->cbowner[s]) { + if (info =3D=3D qemu_clipboard_info(s) && gd->cbowner[s]) { gtk_selection_data_set_text(selection_data, info->types[type].data, info->types[type].size); } else { /* clipboard owner changed while waiting for the data */ } - - qemu_clipboard_info_unref(info); } =20 static void gd_clipboard_clear(GtkClipboard *clipboard, @@ -81,9 +81,7 @@ static void gd_clipboard_notify(Notifier *notifier, void = *data) QemuClipboardSelection s =3D info->selection; bool self_update =3D info->owner =3D=3D &gd->cbpeer; =20 - if (info !=3D gd->cbinfo[s]) { - qemu_clipboard_info_unref(gd->cbinfo[s]); - gd->cbinfo[s] =3D qemu_clipboard_info_ref(info); + if (info !=3D qemu_clipboard_info(s)) { gd->cbpending[s] =3D 0; if (!self_update) { GtkTargetList *list; --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857171651724.952211254079; Wed, 21 Jul 2021 01:46:11 -0700 (PDT) Received: from localhost ([::1]:35056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67rm-0006qm-Ab for importer@patchew.org; Wed, 21 Jul 2021 04:46:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67op-0001Hk-My for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:43:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67oo-0005fv-3l for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:43:07 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-546-TshFtXTjMMyU3y70zdBb7A-1; Wed, 21 Jul 2021 04:43:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64A2A801F97 for ; Wed, 21 Jul 2021 08:43:03 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D67560CCC; Wed, 21 Jul 2021 08:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EWkh/wtLFRZY9CylXtq3NuAaKqDyien2TpzZuEmEdaU=; b=R7bDOphfpg5f8zTQrH1uKOoiMD6na/eyWhlOtGh9l4b16I2rOaVCBla80Q5vbBX0qzMzYL nkxTi1hnb891//1vktf5vCxcnDpCksMLGCKH57wtGRxSok7y34GygjQAb2lOuJMEmoT71I pZdJrX0qJFyYpC1dKDH2dUhOYoWDXVY= X-MC-Unique: TshFtXTjMMyU3y70zdBb7A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 12/13] ui/vdagent: send release when no clipboard owner Date: Wed, 21 Jul 2021 12:41:38 +0400 Message-Id: <20210721084139.1124779-13-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857171969100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/vdagent.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index bc8347f995..efb4546045 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -345,6 +345,24 @@ static void vdagent_send_clipboard_grab(VDAgentChardev= *vd, vdagent_send_msg(vd, msg); } =20 +static void vdagent_send_clipboard_release(VDAgentChardev *vd, + QemuClipboardInfo *info) +{ + g_autofree VDAgentMessage *msg =3D g_malloc0(sizeof(VDAgentMessage) + + sizeof(uint32_t)); + + if (have_selection(vd)) { + uint8_t *s =3D msg->data; + *s =3D info->selection; + msg->size +=3D sizeof(uint32_t); + } else if (info->selection !=3D QEMU_CLIPBOARD_SELECTION_CLIPBOARD) { + return; + } + + msg->type =3D VD_AGENT_CLIPBOARD_RELEASE; + vdagent_send_msg(vd, msg); +} + static void vdagent_send_clipboard_data(VDAgentChardev *vd, QemuClipboardInfo *info, QemuClipboardType type) @@ -386,7 +404,11 @@ static void vdagent_clipboard_notify(Notifier *notifie= r, void *data) if (info !=3D qemu_clipboard_info(s)) { vd->cbpending[s] =3D 0; if (!self_update) { - vdagent_send_clipboard_grab(vd, info); + if (info->owner) { + vdagent_send_clipboard_grab(vd, info); + } else { + vdagent_send_clipboard_release(vd, info); + } } return; } --=20 2.32.0.264.g75ae10bc75 From nobody Tue Feb 10 00:44:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626857543674116.58896046649431; Wed, 21 Jul 2021 01:52:23 -0700 (PDT) Received: from localhost ([::1]:51354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67xl-0001EG-H0 for importer@patchew.org; Wed, 21 Jul 2021 04:52:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67p1-0001pg-Mm for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:43:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50154) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m67p0-0005ot-97 for qemu-devel@nongnu.org; Wed, 21 Jul 2021 04:43:19 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-X1BG1H5KNUW6HT1Vlz6dHQ-1; Wed, 21 Jul 2021 04:43:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A193A800D62 for ; Wed, 21 Jul 2021 08:43:15 +0000 (UTC) Received: from localhost (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53EBD19C79; Wed, 21 Jul 2021 08:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626856997; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1JN7UrKol7qbbldXYzHlGAwiFdzqulFx27Pl4PCm2Ok=; b=ah7v30h7QOnT8v9iq3lizHxtuQlSHe0rhRBQ3GTvocME3O8TP0/fXP85d8etobfYVE2HyC yKcj8akthTdOG/4/GLe6Rh+qp7nC5PlqC/oMvhaIphYJsABE7HQwiWay5ziR/vD/Ym26k2 shNkoLekU0q5/PP1c+hkb9XnD3nsnnU= X-MC-Unique: X1BG1H5KNUW6HT1Vlz6dHQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 13/13] ui/gtk-clipboard: emit release clipboard events Date: Wed, 21 Jul 2021 12:41:39 +0400 Message-Id: <20210721084139.1124779-14-marcandre.lureau@redhat.com> In-Reply-To: <20210721084139.1124779-1-marcandre.lureau@redhat.com> References: <20210721084139.1124779-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.474, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626857544591100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/gtk-clipboard.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index 4e4b3c52bb..16b2e2063e 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -144,7 +144,7 @@ static void gd_owner_change(GtkClipboard *clipboard, { GtkDisplayState *gd =3D data; QemuClipboardSelection s =3D gd_find_selection(gd, clipboard); - QemuClipboardInfo *info; + g_autoptr(QemuClipboardInfo) info =3D NULL; =20 if (gd->cbowner[s]) { /* ignore notifications about our own grabs */ @@ -158,13 +158,13 @@ static void gd_owner_change(GtkClipboard *clipboard, if (gtk_clipboard_wait_is_text_available(clipboard)) { info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true; } - - qemu_clipboard_update(info); - qemu_clipboard_info_unref(info); break; default: + info =3D qemu_clipboard_info_new(NULL, s); + gd->cbowner[s] =3D false; break; } + qemu_clipboard_update(info); } =20 void gd_clipboard_init(GtkDisplayState *gd) --=20 2.32.0.264.g75ae10bc75