diff options
Diffstat (limited to 'platform/linuxbsd/x11/detect_prime_x11.cpp')
-rw-r--r-- | platform/linuxbsd/x11/detect_prime_x11.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/linuxbsd/x11/detect_prime_x11.cpp b/platform/linuxbsd/x11/detect_prime_x11.cpp index 2b5776ce54..c2cb02b937 100644 --- a/platform/linuxbsd/x11/detect_prime_x11.cpp +++ b/platform/linuxbsd/x11/detect_prime_x11.cpp @@ -137,6 +137,19 @@ void create_context() { XFree(vi); } +int silent_error_handler(Display *display, XErrorEvent *error) { + static char message[1024]; + XGetErrorText(display, error->error_code, message, sizeof(message)); + print_verbose(vformat("XServer error: %s" + "\n Major opcode of failed request: %d" + "\n Serial number of failed request: %d" + "\n Current serial number in output stream: %d", + String::utf8(message), (uint64_t)error->request_code, (uint64_t)error->minor_code, (uint64_t)error->serial)); + + quick_exit(1); + return 0; +} + int detect_prime() { pid_t p; int priorities[2] = {}; @@ -189,6 +202,7 @@ int detect_prime() { // cleaning up these processes, and fork() makes a copy // of all globals. CoreGlobals::leak_reporting_enabled = false; + XSetErrorHandler(&silent_error_handler); char string[201]; |