Function gdk::error_trap_push
source · [−]pub fn error_trap_push()
Expand description
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 Display
currently known to the
DisplayManager
. If you don’t care which error happens and just
want to ignore everything, pop with error_trap_pop_ignored()
.
If you need the error code, use 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 gdk_x11_display_error_trap_push()
to ignore errors
on only a single display.
Trapping an X error
⚠️ The following code is in C ⚠️
gdk_error_trap_push ();
// ... Call the X function which may cause an error here ...
if (gdk_error_trap_pop ())
{
// ... Handle the error here ...
}