errorTrapPush
fn
void errorTrapPush()This function allows X errors to be trapped instead of the normal behavior of exiting the application. It should only be used if it is not possible to avoid the X error in any other way. Errors are ignored on all #GdkDisplay currently known to the #GdkDisplayManager. If you don’t care which error happens and just want to ignore everything, pop with [gdk.global.errorTrapPopIgnored]. If you need the error code, use [gdk.global.errorTrapPop] which may have to block and wait for the error to arrive from the X server.
This API exists on all platforms but only does anything on X.
You can use gdk_x11_display_error_trap_push() to ignore errors on only a single display.
Trapping an X error
gdk_error_trap_push ();
// ... Call the X function which may cause an error here ...
if (gdk_error_trap_pop ())
{
// ... Handle the error here ...
}