Blame SOURCES/kvm-ui-avoid-compiler-warnings-from-unused-clipboard-inf.patch

dc1fe0
From c5ff43026547ea20fbb496c5b6734b7e64362151 Mon Sep 17 00:00:00 2001
dc1fe0
From: Gerd Hoffmann <kraxel@redhat.com>
dc1fe0
Date: Mon, 14 Feb 2022 12:37:49 +0100
dc1fe0
Subject: [PATCH 2/6] ui: avoid compiler warnings from unused clipboard info
dc1fe0
 variable
dc1fe0
MIME-Version: 1.0
dc1fe0
Content-Type: text/plain; charset=UTF-8
dc1fe0
Content-Transfer-Encoding: 8bit
dc1fe0
dc1fe0
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
dc1fe0
RH-MergeRequest: 75: fix vnc cut+paste crash
dc1fe0
RH-Commit: [2/4] 6a7982a0bab86bf843fd65842e730a61b2fa2cb0 (kraxel/centos-qemu-kvm)
dc1fe0
RH-Bugzilla: 2042820
dc1fe0
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
dc1fe0
RH-Acked-by: Daniel P. Berrangé <berrange@redhat.com>
dc1fe0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
dc1fe0
dc1fe0
With latest clang 13.0.0 we get
dc1fe0
dc1fe0
../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable]
dc1fe0
    g_autoptr(QemuClipboardInfo) old = NULL;
dc1fe0
                                 ^
dc1fe0
dc1fe0
The compiler can't tell that we only declared this variable in
dc1fe0
order to get the side effect of free'ing it when out of scope.
dc1fe0
dc1fe0
This pattern is a little dubious for a use of g_autoptr, so
dc1fe0
rewrite the code to avoid it.
dc1fe0
dc1fe0
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
dc1fe0
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
dc1fe0
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
dc1fe0
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
dc1fe0
[AJB: fix merge conflict]
dc1fe0
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
dc1fe0
Message-Id: <20211215141949.3512719-2-berrange@redhat.com>
dc1fe0
Message-Id: <20220105135009.1584676-2-alex.bennee@linaro.org>
dc1fe0
(cherry picked from commit 70a54b01693eda3c61814b05d699aba41015ac48)
dc1fe0
---
dc1fe0
 ui/clipboard.c | 3 +--
dc1fe0
 1 file changed, 1 insertion(+), 2 deletions(-)
dc1fe0
dc1fe0
diff --git a/ui/clipboard.c b/ui/clipboard.c
dc1fe0
index d7b008d62a..7672058e84 100644
dc1fe0
--- a/ui/clipboard.c
dc1fe0
+++ b/ui/clipboard.c
dc1fe0
@@ -44,12 +44,11 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer,
dc1fe0
 
dc1fe0
 void qemu_clipboard_update(QemuClipboardInfo *info)
dc1fe0
 {
dc1fe0
-    g_autoptr(QemuClipboardInfo) old = NULL;
dc1fe0
     assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);
dc1fe0
 
dc1fe0
     notifier_list_notify(&clipboard_notifiers, info);
dc1fe0
 
dc1fe0
-    old = cbinfo[info->selection];
dc1fe0
+    qemu_clipboard_info_unref(cbinfo[info->selection]);
dc1fe0
     cbinfo[info->selection] = qemu_clipboard_info_ref(info);
dc1fe0
 }
dc1fe0
 
dc1fe0
-- 
dc1fe0
2.27.0
dc1fe0