summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-11-17 21:07:27 +0000
committerMichael Meeks <michael.meeks@collabora.com>2014-11-17 22:40:16 +0000
commit414c2e2d5ae4c47865adf0338ef7e117fbb8775e (patch)
treeda9c9867ff842f102e3f53f0683808603208c10e /vcl
parent1c20a126d43ca34332f050f6eb847621de99e1b0 (diff)
vcl: initialize data when XGetWindowAttributes fails.
Change-Id: If6fc99483c06efec9a600226a09ead9a3f6dab59
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx27
1 files changed, 22 insertions, 5 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index e7f7f7179e95..33a019d64bb4 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -463,7 +463,12 @@ GLXFBConfig* getFBConfig(Display* dpy, Window win, int& nBestFBC, bool bUseDoubl
SAL_INFO("vcl.opengl", "window: " << win);
XWindowAttributes xattr;
- XGetWindowAttributes( dpy, win, &xattr );
+ if( !XGetWindowAttributes( dpy, win, &xattr ) )
+ {
+ SAL_WARN("vcl.opengl", "Failed to get window attributes for fbconfig " << win);
+ xattr.screen = 0;
+ xattr.visual = NULL;
+ }
int screen = XScreenNumberOfScreen( xattr.screen );
@@ -535,7 +540,11 @@ Visual* getVisual(Display* dpy, Window win)
initOpenGLFunctionPointers();
XWindowAttributes xattr;
- XGetWindowAttributes( dpy, win, &xattr );
+ if( !XGetWindowAttributes( dpy, win, &xattr ) )
+ {
+ SAL_WARN("vcl.opengl", "Failed to get window attributes for getVisual " << win);
+ xattr.visual = NULL;
+ }
SAL_INFO("vcl.opengl", "using VisualID " << xattr.visual);
return xattr.visual;
}
@@ -694,9 +703,17 @@ bool OpenGLContext::ImplInit()
SAL_INFO("vcl.opengl", "available GL extensions: " << m_aGLWin.GLExtensions);
XWindowAttributes xWinAttr;
- XGetWindowAttributes( m_aGLWin.dpy, m_aGLWin.win, &xWinAttr );
- m_aGLWin.Width = xWinAttr.width;
- m_aGLWin.Height = xWinAttr.height;
+ if( !XGetWindowAttributes( m_aGLWin.dpy, m_aGLWin.win, &xWinAttr ) )
+ {
+ SAL_WARN("vcl.opengl", "Failed to get window attributes on " << m_aGLWin.win);
+ m_aGLWin.Width = 0;
+ m_aGLWin.Height = 0;
+ }
+ else
+ {
+ m_aGLWin.Width = xWinAttr.width;
+ m_aGLWin.Height = xWinAttr.height;
+ }
if( m_aGLWin.HasGLXExtension("GLX_SGI_swap_control" ) )
{