[Spice-devel] [spice-gtk v1] gtk-session: reply agent's clipboard request on failure

Pavel Grunt pgrunt at redhat.com
Fri Feb 24 11:36:56 UTC 2017


On Fri, 2017-02-24 at 11:26 +0100, Victor Toso wrote:
> Hi,
> 
> On Fri, Feb 24, 2017 at 11:04:38AM +0100, Pavel Grunt wrote:
> > > > > > +    selection = get_selection_from_clipboard(self->priv,
> > > > > > clipboard);
> > > > > > +    g_return_if_fail(selection != -1);
> > > > 
> > > > so is it not needed to notify here as well ?
> > > 
> > > We can't without knowing the selection.
> > 
> > hmhmhm, you can keep it, it is not related to the patch
> > 
> > the g_return is not needed, selection is used by a function in
> > channel
> > main, and that function should verify it. There can be more
> > improvements (clipboard_received_text_cb is called from
> > clipboard_request which has info about the selection)
> 
> Okay, another improvement for later on them :)
> 
> > > > > >      conv = fixup_clipboard_text(self, text, &len);
> > > > > >      if (!check_clipboard_size_limits(self, len)) {
> > > > > > -        g_free(conv);
> > > > > > -        return;
> > > > > > +        SPICE_DEBUG("Failed sized limits of clipboard
> > > > > > text
> > > > > > (%d
> > > > > > bytes)", len);
> > > > > > +        g_clear_pointer(&conv, g_free);
> > > > 
> > > > thanks to goto there is no need to clear it
> > > 
> > > We do. Conv might not have failed, this check checks the
> > > clipboard_size_limits so, if limit exceed the protocol limit, we
> > > need to
> > > free conv here to send the right value to agent (nothing).
> > 
> > it sends len = 0
> 
> But I don't think it is right to put a valid buffer and 0 as len.

"text" is also nonnull - no difference to me

> At least I think we should avoid it.

> 
>         toso


More information about the Spice-devel mailing list