Don't pass NULL Display to glXGetClientString

glXGetCurrentDisplay can return NULL so need to check
for that.

Change-Id: I1b85a5c575d1deb24dcce4719b6f737283adeabe
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Dāvis Mosāns 2016-01-08 04:12:13 +02:00
parent 1e2b42523f
commit c8af3160d2
2 changed files with 8 additions and 2 deletions

View File

@ -644,7 +644,10 @@ void QGLXContext::queryDummyContext()
oldSurface = oldContext->surface();
QScopedPointer<QSurface> 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);

View File

@ -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;
}