aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickrendercontrol.cpp
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2018-11-07 11:56:48 +0100
committerJüri Valdmann <juri.valdmann@qt.io>2018-11-07 18:33:33 +0000
commit6c08137faf1a53db879701126608833474a2450b (patch)
tree5aa9bb0f3093c74acd5620012eb190bbd4dcf362 /src/quick/items/qquickrendercontrol.cpp
parent74a5ce02667ceefe31aba9a23246b9c512527014 (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/qquickrendercontrol.cpp')
-rw-r--r--src/quick/items/qquickrendercontrol.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index 025acefec2..f6d4e7ed49 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -192,7 +192,8 @@ void QQuickRenderControlPrivate::windowDestroyed()
QQuickWindowPrivate::get(window)->animationController = nullptr;
#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl)
- QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache();
+ if (QOpenGLContext::currentContext())
+ QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache();
#endif
window = nullptr;