[Spice-devel] [PATCH spice-gtk] gtk: don't request clipboard targets when there is no owner
Victor Toso
victortoso at redhat.com
Mon Jan 14 08:58:56 UTC 2019
Hi,
On Sat, Jan 12, 2019 at 06:29:00PM +0100, Jakub Janku wrote:
> Hi,
>
> On Fri, Jan 11, 2019 at 11:40 AM <marcandre.lureau at redhat.com> wrote:
> >
> > From: Marc-André Lureau <marcandre.lureau at redhat.com>
> >
> > After a clipboard-clear, the owner-changed signal is triggered, with
> > no owner. Let's avoid requesting for targets, that would lead to a
> > failure.
> >
> > Fixes:
> > (lt-spicy:23226): GSpice-DEBUG: 13:36:38.741: spice-gtk-session.c:797 clipboard_clear
> > (lt-spicy:23226): GSpice-DEBUG: 13:36:38.742: spice-gtk-session.c:547 clipboard_get_targets:
> > (lt-spicy:23226): GSpice-DEBUG: 13:36:38.742: spice-gtk-session.c:555 Retrieving the clipboard data has failed
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> > ---
> > src/spice-gtk-session.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > index adc72a2..9d7702c 100644
> > --- a/src/spice-gtk-session.c
> > +++ b/src/spice-gtk-session.c
> > @@ -670,7 +670,8 @@ static void clipboard_owner_change(GtkClipboard *clipboard,
> >
> > /* This situation happens when clipboard is being cleared by us, when agent
> > * sends a release-grab for instance */
> > - if (gtk_clipboard_get_owner(clipboard) == G_OBJECT(self)) {
> > + GObject *owner = gtk_clipboard_get_owner(clipboard);
> > + if (owner == NULL || owner == G_OBJECT(self)) {
> > return;
> > }
>
> I'm afraid this commit will have to be reverted as it completely
> disables copy&paste from client to guest:
Yep. My bad in acking that too fast.
> According to the GTK+ docs, gtk_clipboard_get_owner() corresponds to
> the owner object set by gtk_clipboard_set_with_owner().
> So if another application in the client's system grabs the clipboard,
> spice-gtk receives "owner-change" event, gtk_clipboard_get_owner()
> returns NULL and the callback returns without sending a grab to the
> vdagent.
The situation that I was handling, was different indeed, in the
patch you acked before. Oh well.
Many thanks for the clarification above, I'll be sending the
revert shortly.
Victor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190114/4e71e21a/attachment.sig>
More information about the Spice-devel
mailing list