From 716b2c7e4d67d85529845e5ce4bf6ef3db06b43e Mon Sep 17 00:00:00 2001 From: "reveman@google.com" Date: Wed, 29 Jun 2011 18:25:30 +0000 Subject: Check return value of XGetWindowAttributes. There is a chance that |window_| is no longer valid and the call to XGetWindowAttributes will fail and leave |attributes| uninitialized. BUG=chromium-os:16986 TEST=manual Review URL: http://codereview.chromium.org/7273036 git-svn-id: svn://svn.chromium.org/chrome/branches/782/src@90982 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/gfx/gl/gl_surface_glx.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/gfx/gl/gl_surface_glx.cc b/ui/gfx/gl/gl_surface_glx.cc index 30f20a6..0091da7 100644 --- a/ui/gfx/gl/gl_surface_glx.cc +++ b/ui/gfx/gl/gl_surface_glx.cc @@ -149,7 +149,10 @@ bool NativeViewGLSurfaceGLX::Initialize() { DCHECK(!glx_window_); XWindowAttributes attributes; - XGetWindowAttributes(g_display, window_, &attributes); + if (!XGetWindowAttributes(g_display, window_, &attributes)) { + LOG(ERROR) << "XGetWindowAttributes failed for window " << window_ << "."; + return false; + } XVisualInfo visual_template = {0}; visual_template.visualid = XVisualIDFromVisual(attributes.visual); -- cgit v1.1