Index: ui/gfx/gl/gl_context_glx.cc |
diff --git a/ui/gfx/gl/gl_context_glx.cc b/ui/gfx/gl/gl_context_glx.cc |
index a23f1a9b988063d7c7f84db3253fa23d6b3b4bc9..7f702cce60af295407ff8c125eed40e6e03fc90e 100644 |
--- a/ui/gfx/gl/gl_context_glx.cc |
+++ b/ui/gfx/gl/gl_context_glx.cc |
@@ -11,10 +11,16 @@ extern "C" { |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "third_party/mesa/MesaLib/include/GL/osmesa.h" |
+#include "ui/base/x/x11_util.h" |
+#include "ui/base/x/x11_util_internal.h" |
#include "ui/gfx/gl/gl_bindings.h" |
#include "ui/gfx/gl/gl_implementation.h" |
#include "ui/gfx/gl/gl_surface_glx.h" |
+#define CHECK_X_ERROR() do { \ |
+ CHECK(!ui::GetLastX11Error(gfx::GLSurfaceGLX::GetDisplay())); \ |
+ } while(0) |
+ |
namespace gfx { |
namespace { |
@@ -88,6 +94,8 @@ bool GLContextGLX::Initialize(GLSurface* compatible_surface) { |
} |
} |
+ CHECK_X_ERROR(); |
+ |
if (!context_) { |
// The means by which the context is created depends on whether |
// the drawable type works reliably with GLX 1.3. If it does not |
@@ -113,6 +121,8 @@ bool GLContextGLX::Initialize(GLSurface* compatible_surface) { |
return false; |
} |
+ CHECK_X_ERROR(); |
+ |
XVisualInfo visual_info_template; |
visual_info_template.visualid = XVisualIDFromVisual(attributes.visual); |
@@ -136,6 +146,7 @@ bool GLContextGLX::Initialize(GLSurface* compatible_surface) { |
True); |
} |
} |
+ CHECK_X_ERROR(); |
if (!context_) { |
LOG(ERROR) << "Couldn't create GL context."; |