diff options
author | Andras Mantia <andras@kdab.com> | 2018-05-08 11:37:10 +0300 |
---|---|---|
committer | Andras Mantia <andras@kdab.com> | 2018-06-14 09:06:34 +0000 |
commit | bb9e21be9f09ae8e101637bd31558e2532c5412c (patch) | |
tree | a09cdff81349f5b5fb8d9c91a6e0291245561ff6 | |
parent | aa020d45c40206fc6ec3fdd4f589fe5d276d2791 (diff) |
Do not try to create a surface if context creation fails
If context creation fails and we try to create a surface, this might end up
creating a new window that steals the focus from the existing one.
This was visible with a full-screen embedded application using the
software renderer and a QML code using "layer.enabled: true"
Change-Id: If72255a8447d88198249c2d6571aea27d8549b9b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | src/effects/private/qgfxshaderbuilder.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/effects/private/qgfxshaderbuilder.cpp b/src/effects/private/qgfxshaderbuilder.cpp index 22975b5..6439ff3 100644 --- a/src/effects/private/qgfxshaderbuilder.cpp +++ b/src/effects/private/qgfxshaderbuilder.cpp @@ -66,7 +66,12 @@ QGfxShaderBuilder::QGfxShaderBuilder() // thread will get the same capabilities as the render thread's OpenGL // context. Not 100% accurate, but it works... QOpenGLContext context; - context.create(); + if (!context.create()) { + qDebug() << "failed to acquire GL context to resolve capabilities, using defaults.."; + m_maxBlurSamples = 8; // minimum number of varyings in the ES 2.0 spec. + return; + } + QOffscreenSurface surface; // In very odd cases, we can get incompatible configs here unless we pass the // GL context's format on to the offscreen format. |