This seems to happen because TrackPopupMenu returns as soon as the WM_LBUTTONDOWN is received. That message is correctly purged. The problem comes from the subsequent WM_LBUTTONUP message. This patch is not a clean solution, but keeps the problem local. [2. text/plain; patch.diff]...To confirm, is the bug report related to 24.0.50, a rather old version? Have you checked if this bug is present in a recent version of Emacs?
Yes, it is present in current version.