Comment 14 for bug 1368499

Revision history for this message
In , Rinat (ibragimovrinat) wrote :

Created attachment 6894
Avoid calling gtk_clipboard_clear()

I think there is no sense in calling gtk_clipboard_clear() after
gtk_clipboard_set_text(). Latter makes a copy of data, and sets
required reply callback, so other applications will get an empty
string which is fine. Calling _clear() makes GTK+ to call
XSetSelectionOwner() with owner=None, which may cause change of
selection owner with "strikeback" effect.

Also passing length of 1 looks wrong. String is empty, so its
length should be 0. Luckily, GTK+ uses g_strndup() inside, which
makes it an empty string rather than a string of one '\0'.

This patch fixes issue for me. I could reproduce it before the
patch, and can't reproduce after.