|
Analysis-Utilities 26.9.9
C++/ROOT utilities for nuclear measurement data analysis
|
Stops a recoverable X protocol error from becoming a fatal SIGSEGV. More...
#include <Rtypes.h>#include <dlfcn.h>Go to the source code of this file.
Classes | |
| struct | AUXErrorHandlerSave |
| What AUInstallTolerantXErrorHandler() needs in order to undo itself. More... | |
Typedefs | |
| typedef int(* | AUXErrorHandler) (void *display, void *event) |
| Xlib error handler signature, with opaque pointers so that no libX11 headers are needed here. | |
| typedef AUXErrorHandler(* | AUXSetErrorHandlerFn) (AUXErrorHandler) |
| Signature of XSetErrorHandler itself, resolved via dlsym. | |
Functions | |
| int | AUIgnoreXError (void *, void *) |
| The tolerant handler: ignores the error and reports success. | |
| AUXErrorHandlerSave | AUInstallTolerantXErrorHandler () |
| Install the tolerant X error handler for the duration of an event loop. | |
| void | AURestoreXErrorHandler (AUXErrorHandlerSave s) |
| Put back the handler that was in place before the tolerant one. | |
Stops a recoverable X protocol error from becoming a fatal SIGSEGV.
When a TGTextEntry (the editors' number entries, for instance) is redrawn through the TTF backend, TGX11TTF::DrawString issues an XGetGeometry round-trip on the widget's drawable. If that drawable is momentarily stale the X server answers with BadWindow / BadDrawable. Xlib then calls ROOT's RootX11ErrorHandler, which looks the offending window up by id and calls a virtual method on it to format the message — and if that window object is already gone, the handler itself crashes. A recoverable protocol error thus becomes a fatal SIGSEGV that takes down the entire ROOT session.
While an interactive editor pumps its own event loop, these helpers install a no-op handler that swallows such errors — Xlib ignores the return value for non-fatal errors and carries on — and then restore the previous one.
XSetErrorHandler is resolved at runtime via dlsym, so this library keeps no link-time dependency on libX11; the symbol comes from libX11, which ROOT's GUI libraries load transitively whenever a gClient exists.
Definition in file InteractiveEditorX11Guard.hpp.
| typedef int(* AUXErrorHandler) (void *display, void *event) |
Xlib error handler signature, with opaque pointers so that no libX11 headers are needed here.
Definition at line 31 of file InteractiveEditorX11Guard.hpp.
| typedef AUXErrorHandler(* AUXSetErrorHandlerFn) (AUXErrorHandler) |
Signature of XSetErrorHandler itself, resolved via dlsym.
Definition at line 34 of file InteractiveEditorX11Guard.hpp.
|
inline |
The tolerant handler: ignores the error and reports success.
Definition at line 38 of file InteractiveEditorX11Guard.hpp.
Referenced by AUInstallTolerantXErrorHandler().
|
inline |
Install the tolerant X error handler for the duration of an event loop.
Resolves XSetErrorHandler from the default symbol scope; if libX11 was loaded with local scope the lookup is retried against an RTLD_NOLOAD handle, which promotes the already-mapped library rather than loading a second copy.
Definition at line 70 of file InteractiveEditorX11Guard.hpp.
Referenced by LaunchInteractiveFitEditor(), LaunchInteractiveRooFitEditor(), and LaunchInteractiveSimultaneousFitEditor().
|
inline |
Put back the handler that was in place before the tolerant one.
| s | Value returned by AUInstallTolerantXErrorHandler(). Safe to pass a state whose resolution failed; the call then does nothing. |
Definition at line 90 of file InteractiveEditorX11Guard.hpp.
Referenced by LaunchInteractiveFitEditor(), LaunchInteractiveRooFitEditor(), and LaunchInteractiveSimultaneousFitEditor().