[spice-gtk,v2,5/7] channel-main: clipboard release: don't fail silently

Submitted by Victor Toso on Dec. 10, 2018, 11:02 a.m.

Details

Message ID 20181210110256.20115-6-victortoso@redhat.com
State New
Headers show
Series "small code improvements on clipboard" ( rev: 1 ) in Spice

Commit Message

Victor Toso Dec. 10, 2018, 11:02 a.m.
From: Victor Toso <me@victortoso.com>

Spice client should listen to SpiceMainChannel::agent-connected
notification and avoid calling any clipboard related functions such as
spice_gtk_session_paste_from_guest() from client-gtk library.

This patch removes the silent return of
spice_main_channel_clipboard_selection_release() in order to catch
bugs with the proper check in agent_clipboard_release().

Signed-off-by: Victor Toso <victortoso@redhat.com>
---
 src/channel-main.c | 5 -----
 1 file changed, 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/channel-main.c b/src/channel-main.c
index 5bcd149..223043a 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2825,11 +2825,6 @@  void spice_main_channel_clipboard_selection_release(SpiceMainChannel *channel, g
     g_return_if_fail(channel != NULL);
     g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel));
 
-    SpiceMainChannelPrivate *c = channel->priv;
-
-    if (!c->agent_connected)
-        return;
-
     if (agent_clipboard_release(channel, selection)) {
         spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE);
     }

Comments

On 12/10/18 1:02 PM, Victor Toso wrote:
> From: Victor Toso <me@victortoso.com>
> 
> Spice client should listen to SpiceMainChannel::agent-connected
> notification and avoid calling any clipboard related functions such as
> spice_gtk_session_paste_from_guest() from client-gtk library.
> 
> This patch removes the silent return of
> spice_main_channel_clipboard_selection_release() in order to catch
> bugs with the proper check in agent_clipboard_release().

I did not test, but possibly it too generates a lot
of error messages, as Frediano mentioned on a different
patch (6/7).

Uri.

> 
> Signed-off-by: Victor Toso <victortoso@redhat.com>
> ---
>   src/channel-main.c | 5 -----
>   1 file changed, 5 deletions(-)
> 
> diff --git a/src/channel-main.c b/src/channel-main.c
> index 5bcd149..223043a 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -2825,11 +2825,6 @@ void spice_main_channel_clipboard_selection_release(SpiceMainChannel *channel, g
>       g_return_if_fail(channel != NULL);
>       g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel));
>   
> -    SpiceMainChannelPrivate *c = channel->priv;
> -
> -    if (!c->agent_connected)
> -        return;
> -
>       if (agent_clipboard_release(channel, selection)) {
>           spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE);
>       }
>
Hi,

On Thu, Dec 13, 2018 at 04:06:11PM +0200, Uri Lublin wrote:
> On 12/10/18 1:02 PM, Victor Toso wrote:
> > From: Victor Toso <me@victortoso.com>
> > 
> > Spice client should listen to SpiceMainChannel::agent-connected
> > notification and avoid calling any clipboard related functions such as
> > spice_gtk_session_paste_from_guest() from client-gtk library.
> > 
> > This patch removes the silent return of
> > spice_main_channel_clipboard_selection_release() in order to catch
> > bugs with the proper check in agent_clipboard_release().
> 
> I did not test, but possibly it too generates a lot
> of error messages, as Frediano mentioned on a different
> patch (6/7).
> 
> Uri.

Indeed. I plan to resend later on.

Thanks for the reviews!

> > Signed-off-by: Victor Toso <victortoso@redhat.com>
> > ---
> >   src/channel-main.c | 5 -----
> >   1 file changed, 5 deletions(-)
> > 
> > diff --git a/src/channel-main.c b/src/channel-main.c
> > index 5bcd149..223043a 100644
> > --- a/src/channel-main.c
> > +++ b/src/channel-main.c
> > @@ -2825,11 +2825,6 @@ void spice_main_channel_clipboard_selection_release(SpiceMainChannel *channel, g
> >       g_return_if_fail(channel != NULL);
> >       g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel));
> > -    SpiceMainChannelPrivate *c = channel->priv;
> > -
> > -    if (!c->agent_connected)
> > -        return;
> > -
> >       if (agent_clipboard_release(channel, selection)) {
> >           spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE);
> >       }
> > 
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel