Gdk.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 gdk.Display currently known to the gdk.DisplayManager If you don’t care which error happens and just want to ignore everything, pop with gdk_error_trap_pop_ignored(). If you need the error code, use gdk_error_trap_pop() 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 X11.displayErrorTrapPush 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 ...
}
struct Gdk
static
void
errorTrapPush
()