[Spice-devel] [spice-gtk] Ensure '\0' is not part of text clipboard data

Marc-André Lureau mlureau at redhat.com
Tue Aug 12 08:15:58 PDT 2014


ack

----- Original Message -----
> On Windows, with some versions of gtk+, GtkSelectionData::length
> will include the final '\0'.
> When a string with this trailing '\0' is pasted in some linux
> applications, it will be pasted as <NIL> or as an invisible character,
> which is unwanted.
> 
> This commit ensures the length we send to the agent does not
> include any trailing '\0'.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1090122
> ---
>  gtk/spice-gtk-session.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
> index db5c53c..84a83a2 100644
> --- a/gtk/spice-gtk-session.c
> +++ b/gtk/spice-gtk-session.c
> @@ -890,6 +890,15 @@ static void clipboard_received_cb(GtkClipboard
> *clipboard,
>          }
>  
>          len = strlen(conv);
> +    } else {
> +        /* On Windows, with some versions of gtk+, GtkSelectionData::length
> +         * will include the final '\0'. When a string with this trailing
> '\0'
> +         * is pasted in some linux applications, it will be pasted as <NIL>
> or
> +         * as an invisible character, which is unwanted. Ensure the length
> we
> +         * send to the agent does not include any trailing '\0'
> +         * This is gtk+ bug
> https://bugzilla.gnome.org/show_bug.cgi?id=734670
> +         */
> +        len = strlen((const char *)data);
>      }
>  
>      spice_main_clipboard_selection_notify(s->main, selection, type,
> --
> 1.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list