diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2018-11-07 11:56:48 +0100 |
---|---|---|
committer | Jüri Valdmann <juri.valdmann@qt.io> | 2018-11-07 18:33:33 +0000 |
commit | 6c08137faf1a53db879701126608833474a2450b (patch) | |
tree | 5aa9bb0f3093c74acd5620012eb190bbd4dcf362 /src/quick/items/qquickopenglshadereffectnode.cpp | |
parent | 74a5ce02667ceefe31aba9a23246b9c512527014 (diff) |
Fix null pointer access in QQuickOpenGLShaderEffectMaterialCache
If a QQuickWindow is destroyed without ever being rendered, then there won't be
any QOpenGLContext in QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache.
Same goes for QQuickWidgetRenderControl.
Fixes: QTBUG-65236
Change-Id: I2742505d147bc8444b46688170d33fbb2844f2ac
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/items/qquickopenglshadereffectnode.cpp')
-rw-r--r-- | src/quick/items/qquickopenglshadereffectnode.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/quick/items/qquickopenglshadereffectnode.cpp b/src/quick/items/qquickopenglshadereffectnode.cpp index d51419a275..f32b32491b 100644 --- a/src/quick/items/qquickopenglshadereffectnode.cpp +++ b/src/quick/items/qquickopenglshadereffectnode.cpp @@ -366,6 +366,7 @@ class QQuickOpenGLShaderEffectMaterialCache : public QObject public: static QQuickOpenGLShaderEffectMaterialCache *get(bool create = true) { QOpenGLContext *ctx = QOpenGLContext::currentContext(); + Q_ASSERT(ctx); QQuickOpenGLShaderEffectMaterialCache *me = ctx->findChild<QQuickOpenGLShaderEffectMaterialCache *>(QStringLiteral("__qt_ShaderEffectCache"), Qt::FindDirectChildrenOnly); if (!me && create) { me = new QQuickOpenGLShaderEffectMaterialCache(); |