External clipboard managers prevent the above code from clearing the clipboard.
On Fedora 19 KDE, klipper
came pre-installed. After closing it, there wasn't any more problems with clearing the function. Similarly on Fedora 19 LXDE, clipit
came pre-installed.