[Spice-devel] [spice-gtk] clipboard: Return early on fixup_clipboard_text errors()
Christophe Fergeau
cfergeau at redhat.com
Thu Sep 1 13:58:25 UTC 2016
On Thu, Sep 01, 2016 at 03:41:38PM +0200, Christophe Fergeau wrote:
> On Thu, Sep 01, 2016 at 01:57:16PM +0200, Pavel Grunt wrote:
> > Hi,
> >
> > On Thu, 2016-09-01 at 13:11 +0200, Christophe Fergeau wrote:
> > > 5c8f400 "clipboard: Add clipboard_atom_to_vdagent_type helper"
> > > mistakenly removed some early returns when text conversion fails for
> > > some reason. This commit readds it.
> > > ---
> > > src/spice-gtk-session.c | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > > index 5766bbd..e0a79de 100644
> > > --- a/src/spice-gtk-session.c
> > > +++ b/src/spice-gtk-session.c
> > > @@ -1026,6 +1026,9 @@ static void clipboard_received_text_cb(GtkClipboard
> > > *clipboard,
> > >
> > > /* gtk+ internal utf8 newline is always LF, even on windows */
> > > conv = fixup_clipboard_text(self, text, &len);
> > > + if (conv == NULL) {
> > > + return;
> > > + }
> > >
> >
> > I didn't think it is an issue since the following call deals with conv == NULL,
> > with this patch you should remove the ternary
>
> Initially (before these patches), the ternary was used in the !text case I believe.
> I'd prefer to keep the initial behaviour of not sending clipboard data
> if the conversion failed.
Ah but the helper also returns NULL when no conversion is needed :(
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160901/acd50d3a/attachment.sig>
More information about the Spice-devel
mailing list