I think the problem is deeper. I reported a similar problem back
in 1995.
Message-Id: <OAAyiex00455.199503221955(a)crystal.WonderWorks.COM>
From: kyle_jones(a)wonderworks.com (Kyle Jones)
To: xemacs-beta(a)cs.uiuc.edu
Subject: nasty minibuffer interaction bug
Date: Wed, 22 Mar 1995 14:55:19 -0500
xemacs -q
Type a few lines of crap into the *scratch buffer.
C-x 5 2
C-x b
Type a string that doesn't prefix any existing buffer name.
Hit TAB.
Wait for the "[No match]" caption to appear.
Before the caption disappears move the mouse to the other Emacs frame.
Watch most of the text in the *scratch* buffer disappear.
Async buffer changes are bad juju. I wonder what else this
breaks.
As I recall this problem was fixed somewhere in the bowels of
the C code so that focus change events either weren't processed
immediately or didn't take effect until the top of the command
loop. Maybe this change was reversed sometime since then.
I think deferring focus changes is the correct fix for this
problem.