3 ms·
It is also the only way for an xlib program to survive losing its connection to the X server. xlib will let you register a callback to handle loss of connectio
by kijiki 7y ago
It is also the only way for an xlib program to survive losing its connection to the X server. xlib will let you register a callback to handle loss of connection with XSetIOErrorHandler, but unconditionally calls exit() after your callback returns. Which is extremely anti-social behavior for a library, but that is what it does.
So the solution is to setjmp before each call to an X function that might notice the connection is closed, and longjmp out of the error callback. Ugly, but it works.
These days, you should really just use XCB, or even Wayland.
- LorenPechtel 7y agoThat's nuke-from-orbit level stupidity!