aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-04-11 16:21:54 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-23 09:10:18 +0200
commit4e4228e0b1c01edada84d82746e3360aeffeb037 (patch)
treef39531393885e6940c6e4940f202c1a40a104f13 /src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
parent964dcdfb7bc106696b4be12b7f71ba52f8448973 (diff)
Support shutting down the render thread without an OpenGL context.
[ChangeLog][QtQuick][SceneGraph] There might not be an OpenGL context bound when QQuickWindow::sceneGraphInvalidated() is emitted if an error occurs while cleaning up the scene graph (such as EGL_CONTEXT_LOST). This is according to the documentation, but has never occurred in practice before. Change-Id: I13dbfbb4b6d0d27fa42fcb8b54df16ea02284807 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp')
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 04f2bc891b..791e06ece2 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -836,10 +836,12 @@ static void qsg_wipeBatch(Batch *batch, QOpenGLFunctions *funcs)
Renderer::~Renderer()
{
- // Clean up batches and buffers
- for (int i=0; i<m_opaqueBatches.size(); ++i) qsg_wipeBatch(m_opaqueBatches.at(i), this);
- for (int i=0; i<m_alphaBatches.size(); ++i) qsg_wipeBatch(m_alphaBatches.at(i), this);
- for (int i=0; i<m_batchPool.size(); ++i) qsg_wipeBatch(m_batchPool.at(i), this);
+ if (QOpenGLContext::currentContext()) {
+ // Clean up batches and buffers
+ for (int i=0; i<m_opaqueBatches.size(); ++i) qsg_wipeBatch(m_opaqueBatches.at(i), this);
+ for (int i=0; i<m_alphaBatches.size(); ++i) qsg_wipeBatch(m_alphaBatches.at(i), this);
+ for (int i=0; i<m_batchPool.size(); ++i) qsg_wipeBatch(m_batchPool.at(i), this);
+ }
// The shadowtree
qDeleteAll(m_nodes.values());