From 8d9c42e36217e14efa69974c2cdc8d90f465a959 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 27 Oct 2016 09:49:24 +0200 Subject: 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 --- src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/plugins/platforms/xcb') 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; -- cgit v1.2.3