It looks like under certain conditions a user error handler routine set by XSetErrorHandler can be effectively canceled from inside of Xt/Selection.c. The place to suspect is the loop in the SelectionRequest case of HandleSelectionEvents function. Under certain conditions there can be several two calls to EndProtectedSection after single StartProtectedSection. Since EndProtectedSection zeroes the global oldErrorHandler variable, the second call to EndProtectedSection restores the default error procedure instead of user's one. Probably there exist more than one problematic code fragments. (Checked in 6.6 and 6.8.1 sources).
*** This bug has been marked as a duplicate of 1478 ***
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.