summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/gl_integrations/xcb_glx
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2016-10-27 09:49:24 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2016-10-28 10:01:31 +0000
commit8d9c42e36217e14efa69974c2cdc8d90f465a959 (patch)
tree400c823ff8d3513a041f7d337fe7b3ea61aaa3de /src/plugins/platforms/xcb/gl_integrations/xcb_glx
parentaf0d0b9c06c18850626e5454b39b45255c3e36cb (diff)
xcb: Avoid crash when requesting non-supported stereo formats
Introduced in the 5.7 branch by 5f39a0ef8d037ed8d1fa19d5514308ed4a2ca161. Add also a warning in the GLX backend instead of just dereferencing the null pointer. Task-number: QTBUG-55291 Change-Id: I1f2930768b39a04ee443a68d0ac7dc9ecf26cb9c Reviewed-by: Louai Al-Khanji <louai.al-khanji@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/gl_integrations/xcb_glx')
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp
index 8ae83b8084..a8d51d5e8c 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp
@@ -59,6 +59,10 @@ const xcb_visualtype_t *QXcbGlxWindow::createVisual()
if (!scr)
return Q_NULLPTR;
XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(scr), scr->screenNumber(), &m_format);
+ if (!visualInfo) {
+ qWarning() << "No XVisualInfo for format" << m_format;
+ return Q_NULLPTR;
+ }
const xcb_visualtype_t *xcb_visualtype = scr->visualForId(visualInfo->visualid);
XFree(visualInfo);
return xcb_visualtype;