I have an Emacs running, and a middle-click pastes text that is not the primary selection (note: it is not the content of the clipboard either, as seen with Ctrl-Y). Changing the primary selection by selecting something else in an xterm does not solve this issue. Running a different Emacs instance does not show this issue, thus the bug is in Emacs and is visible under some unknown conditions. I could eventually avoid the issue without restarting Emacs by selecting some text in the running Emacs.