From c8af3160d2514fb973a0d00d5bac324d4f7159f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C4=81vis=20Mos=C4=81ns?= Date: Fri, 8 Jan 2016 04:12:13 +0200 Subject: Don't pass NULL Display to glXGetClientString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glXGetCurrentDisplay can return NULL so need to check for that. Change-Id: I1b85a5c575d1deb24dcce4719b6f737283adeabe Reviewed-by: Błażej Szczygieł Reviewed-by: Laszlo Agocs --- .../platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 5 ++++- .../platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index 8b14fc7d70..3412f3f3fc 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -644,7 +644,10 @@ void QGLXContext::queryDummyContext() oldSurface = oldContext->surface(); QScopedPointer surface; - const char *glxvendor = glXGetClientString(glXGetCurrentDisplay(), GLX_VENDOR); + Display *display = glXGetCurrentDisplay(); + const char *glxvendor = 0; + if (display) + glxvendor = glXGetClientString(display, GLX_VENDOR); if (glxvendor && !strcmp(glxvendor, "ATI")) { QWindow *window = new QWindow; window->resize(64, 64); diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp index ce72cb64d0..cd4949af5c 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp @@ -195,7 +195,10 @@ QPlatformOffscreenSurface *QXcbGlxIntegration::createPlatformOffscreenSurface(QO static bool glxPbufferUsable = true; if (!vendorChecked) { vendorChecked = true; - const char *glxvendor = glXGetClientString(glXGetCurrentDisplay(), GLX_VENDOR); + Display *display = glXGetCurrentDisplay(); + const char *glxvendor = 0; + if (display) + glxvendor = glXGetClientString(display, GLX_VENDOR); if (glxvendor && !strcmp(glxvendor, "ATI")) glxPbufferUsable = false; } -- cgit v1.2.3