diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2014-11-17 21:07:27 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-11-17 21:07:27 +0000 |
commit | ea95f561a10ea48d63cf94e6ad35b647b083cfb9 (patch) | |
tree | f67bc6aba0e926468fd71ee237a5bb60b8a89846 | |
parent | vcl: only use default windows' GL Context for bitmaps if NULL / uninitialized. (diff) | |
download | core-ea95f561a10ea48d63cf94e6ad35b647b083cfb9.tar.gz core-ea95f561a10ea48d63cf94e6ad35b647b083cfb9.zip |
vcl: initialize data when XGetWindowAttributes fails.
Change-Id: If6fc99483c06efec9a600226a09ead9a3f6dab59
-rw-r--r-- | vcl/source/opengl/OpenGLContext.cxx | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 0659ce5b57e0..cf1925875268 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -465,7 +465,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 ); @@ -537,7 +542,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; } @@ -696,9 +705,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" ) ) { |