Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Unified Diff: ui/base/x/x11_util.cc

Issue 7889040: Change X11 error handler override to allow easy X11 error checking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/base/x/x11_util_internal.h » ('j') | ui/gfx/gl/gl_context_glx.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | ui/base/x/x11_util_internal.h » ('j') | ui/gfx/gl/gl_context_glx.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698