From abd87f99983f103d38085bb732ef291516bf5055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Thu, 27 Jun 2019 09:50:28 +0300 Subject: Fix crash in format discovery Simpleqml example crashes with the lambda approach. Change to regular function. Task-number: QT3DS-3721 Change-Id: I6cddd2b70c47bfb27fb2e87db02bf80a84285751 Reviewed-by: Miikka Heikkinen --- src/foundation/qt/formatdiscovery.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/foundation/qt/formatdiscovery.cpp b/src/foundation/qt/formatdiscovery.cpp index 7ea762b..0a4bcbd 100644 --- a/src/foundation/qt/formatdiscovery.cpp +++ b/src/foundation/qt/formatdiscovery.cpp @@ -104,22 +104,22 @@ static QSurfaceFormat findIdealGLESVersion() return fmt; } +static QSurfaceFormat s_f; + QSurfaceFormat surfaceFormat() { - static const QSurfaceFormat f = [] { - QSurfaceFormat fmt; + if (s_f.renderableType() == QSurfaceFormat::DefaultRenderableType) { // works in dynamic gl builds too because there's a qguiapp already // this requirement is also a problem, see QT3DS-3603 if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) - fmt = findIdealGLVersion(); + s_f = findIdealGLVersion(); else - fmt = findIdealGLESVersion(); - fmt.setDepthBufferSize(24); - fmt.setStencilBufferSize(8); + s_f = findIdealGLESVersion(); + s_f.setDepthBufferSize(24); + s_f.setStencilBufferSize(8); // Ignore MSAA here as that is a per-layer setting. - return fmt; - }(); - return f; + } + return s_f; } } // End namespace Q3DS -- cgit v1.2.3