fix a deadlock in `xmessage()`

Previously, `xmessage()` locks the mutex and (on some condition) it
calls `xerror_redirect()`, which also try to lock the mutex.  I create
another function, `xerror_redirect_unlocked()` which has nothing to do
with the mutex, and calls it in `xmessage()`.