Add a warning and a return value to xcb's createGLPlatformContext
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Fri, 14 Oct 2011 21:17:30 +0000 (00:17 +0300)
committerQt by Nokia <qt-info@nokia.com>
Mon, 17 Oct 2011 08:29:57 +0000 (10:29 +0200)
There was no value returned previously when none of GLX, EGL, DRI was
enabled. Now we show a warning message and return null (resulting in a
crash). Previously not returning a value resulted in obscure crashes
with strange-looking call stacks, now it will be clear what the
problem is.

This is particularly important because not having libx11-xcb-dev
installed results in silently disabled xlib support which in turn
disallows the usage of glx too. The result is an obscure crash in any
GL (e.g. QML2) app. Now there will be a proper warning message at
least.

Change-Id: I15cf3a6c16ca373d4ada7abb6d3c8f7e30c1e03d
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/plugins/platforms/xcb/qxcbintegration.cpp

index 91d7e28..aa5c7e4 100644 (file)
@@ -175,6 +175,8 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
 #elif defined(XCB_USE_DRI2)
     return new QDri2Context(context->format(), context->shareHandle());
 #endif
+    qWarning("Cannot create platform GL context, none of GLX, EGL, DRI2 is enabled");
+    return 0;
 }
 
 QPlatformBackingStore *QXcbIntegration::createPlatformBackingStore(QWindow *window) const