aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdefaultrendercontext.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-08-19 14:42:31 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-19 15:06:17 +0000
commitb8f145547e5477cd67f464c2d834f60a84f4aad6 (patch)
tree72ae362175efb9e0697eea8f1d326d2d8ba2fb3e /src/quick/scenegraph/qsgdefaultrendercontext.cpp
parent863a76281cefd19d7e339a78a63c86dff0f9dcce (diff)
Fix race-condition crash on shut-down in QtWebEngine
If a QQuickWidget is somehow deleted below a QApplication post-routine it may end up being deleted after QQuickRenderControlPrivate::cleanup(), which means its QSGContext is deleted. Change-Id: I396d236f997b7b68a96f8fdddd7d6c3fe31c10b0 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultrendercontext.cpp')
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
index 4fcc81fb18..6f10611ba3 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp
+++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
@@ -70,6 +70,9 @@ QSGDefaultRenderContext::QSGDefaultRenderContext(QSGContext *context)
*/
void QSGDefaultRenderContext::initialize(void *context)
{
+ if (!m_sg)
+ return;
+
QOpenGLContext *openglContext = static_cast<QOpenGLContext *>(context);
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
@@ -163,7 +166,8 @@ void QSGDefaultRenderContext::invalidate()
m_gl->setProperty(QSG_RENDERCONTEXT_PROPERTY, QVariant());
m_gl = 0;
- m_sg->renderContextInvalidated(this);
+ if (m_sg)
+ m_sg->renderContextInvalidated(this);
emit invalidated();
}