Index: ui/base/x/x11_util.cc |
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc |
index 82cdab78f54bc87e603501517f112e3db282c54e..5efdb9105edddc0ed1a10885ed53186de8517eca 100644 |
--- a/ui/base/x/x11_util.cc |
+++ b/ui/base/x/x11_util.cc |
@@ -56,6 +56,9 @@ CachedPictFormats* get_cached_pict_formats() { |
// Maximum number of CachedPictFormats we keep around. |
const size_t kMaxCacheSize = 5; |
+XErrorHandler error_handler_ = NULL; |
Ami GONE FROM CHROMIUM
2011/09/14 17:11:13
file-statics don't get trailing underscores (here
dominich
2011/09/14 19:55:06
Done.
|
+XIOErrorHandler io_error_handler_ = NULL; |
+ |
int DefaultX11ErrorHandler(Display* d, XErrorEvent* e) { |
MessageLoop::current()->PostTask( |
FROM_HERE, NewRunnableFunction(LogErrorEventDescription, d, *e)); |
@@ -788,9 +791,11 @@ XRenderPictFormat* GetRenderVisualFormat(Display* dpy, Visual* visual) { |
void SetX11ErrorHandlers(XErrorHandler error_handler, |
XIOErrorHandler io_error_handler) { |
- XSetErrorHandler(error_handler ? error_handler : DefaultX11ErrorHandler); |
- XSetIOErrorHandler( |
- io_error_handler ? io_error_handler : DefaultX11IOErrorHandler); |
+ error_handler_ = error_handler ? error_handler : DefaultX11ErrorHandler; |
+ io_error_handler_ = io_error_handler ? |
+ io_error_handler : DefaultX11IOErrorHandler; |
+ XSetErrorHandler(error_handler_); |
+ XSetIOErrorHandler(io_error_handler_); |
} |
void LogErrorEventDescription(Display* dpy, |
@@ -835,6 +840,17 @@ void LogErrorEventDescription(Display* dpy, |
<< " (" << request_str << ")"; |
} |
+ScopedX11ErrorHandlerOverride::ScopedX11ErrorHandlerOverride( |
+ XErrorHandler error_handler, XIOErrorHandler io_error_handler) |
+ : old_error_handler_(error_handler_), |
+ old_io_error_handler_(io_error_handler_) { |
+ ui::SetX11ErrorHandlers(error_handler, io_error_handler); |
Ami GONE FROM CHROMIUM
2011/09/14 17:11:13
ui:: here and below unnecessary?
Ami GONE FROM CHROMIUM
2011/09/14 17:11:13
I expected sync calls here and in the dtor.
dominich
2011/09/14 19:55:06
Done.
dominich
2011/09/14 19:55:06
Done.
|
+} |
+ |
+ScopedX11ErrorHandlerOverride::~ScopedX11ErrorHandlerOverride() { |
+ ui::SetX11ErrorHandlers(old_error_handler_, old_io_error_handler_); |
+} |
+ |
// ---------------------------------------------------------------------------- |
// End of x11_util_internal.h |