From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
Eduardo Habkost <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [PULL 4/8] ui/vnc-clipboard: fix adding notifier twice
Date: Mon, 22 Nov 2021 13:40:11 +0100 [thread overview]
Message-ID: <20211122124015.909318-5-kraxel@redhat.com> (raw)
In-Reply-To: <20211122124015.909318-1-kraxel@redhat.com>
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
vnc_server_cut_text_caps() is not guaranteed to be called only once.
If it called twice, we finally call notifier_list_add() twice with same
element. Which leads to loopback QLIST. So, on next
notifier_list_notify() we'll loop forever and QEMU stuck.
So, let's only register new notifier if it's not yet registered.
Note, that similar check is used in vdagent_chr_recv_caps() (before
call qemu_clipboard_peer_register()), and also before
qemu_clipboard_peer_unregister() call in vdagent_disconnect() and in
vnc_disconnect_finish().
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211110103800.2266729-1-vsementsov@virtuozzo.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/vnc-clipboard.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/ui/vnc-clipboard.c b/ui/vnc-clipboard.c
index 9f077965d056..67284b556cd8 100644
--- a/ui/vnc-clipboard.c
+++ b/ui/vnc-clipboard.c
@@ -316,8 +316,10 @@ void vnc_server_cut_text_caps(VncState *vs)
caps[1] = 0;
vnc_clipboard_send(vs, 2, caps);
- vs->cbpeer.name = "vnc";
- vs->cbpeer.update.notify = vnc_clipboard_notify;
- vs->cbpeer.request = vnc_clipboard_request;
- qemu_clipboard_peer_register(&vs->cbpeer);
+ if (!vs->cbpeer.update.notify) {
+ vs->cbpeer.name = "vnc";
+ vs->cbpeer.update.notify = vnc_clipboard_notify;
+ vs->cbpeer.request = vnc_clipboard_request;
+ qemu_clipboard_peer_register(&vs->cbpeer);
+ }
}
--
2.33.1
next prev parent reply other threads:[~2021-11-22 12:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 12:40 [PULL 0/8] Fixes 20211122 patches Gerd Hoffmann
2021-11-22 12:40 ` [PULL 1/8] ui: fix incorrect scaling on highdpi with gtk/opengl Gerd Hoffmann
2021-11-22 12:40 ` [PULL 2/8] ui: fix incorrect pointer position on highdpi with gtk Gerd Hoffmann
2021-11-22 12:40 ` [PULL 3/8] ui/gtk: graphic_hw_gl_flushed after closing dmabuf->fence_fd Gerd Hoffmann
2021-11-22 12:40 ` Gerd Hoffmann [this message]
2021-11-22 12:40 ` [PULL 5/8] migration: fix dump-vmstate with modules Gerd Hoffmann
2021-11-22 12:40 ` [PULL 6/8] hw/i386/microvm: Reduce annoying debug message in dt_setup_microvm() Gerd Hoffmann
2021-11-22 12:40 ` [PULL 7/8] microvm: add missing g_free() call Gerd Hoffmann
2021-11-22 12:40 ` [PULL 8/8] microvm: check g_file_set_contents() return value Gerd Hoffmann
2021-11-22 15:35 ` [PULL 0/8] Fixes 20211122 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=20211122124015.909318-5-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=ehabkost@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=vsementsov@virtuozzo.com \
/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).