aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp10
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp14
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp6
3 files changed, 15 insertions, 15 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());
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 2135bbef38..7b01f64ee0 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -398,6 +398,7 @@ bool QSGRenderThread::event(QEvent *e)
QSG_RT_DEBUG(" - setting exit flag and invalidating GL");
invalidateOpenGL(wme->window, wme->inDestructor, wme->fallbackSurface);
active = gl;
+ Q_ASSERT_X(!wme->inDestructor || !active, "QSGRenderThread::invalidateOpenGL()", "Thread's active state is not set to false when shutting down");
if (sleeping)
stopEventProcessing = true;
} else {
@@ -462,11 +463,8 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor,
bool wipeGL = inDestructor || (wipeSG && !window->isPersistentOpenGLContext());
bool current = gl->makeCurrent(fallback ? static_cast<QSurface *>(fallback) : static_cast<QSurface *>(window));
- if (!current) {
-#ifndef QT_NO_DEBUG
- qWarning() << "Scene Graph failed to acquire GL context during cleanup";
-#endif
- return;
+ if (Q_UNLIKELY(!current)) {
+ QSG_RT_DEBUG(" - cleanup without an OpenGL context");
}
// The canvas nodes must be cleaned up regardless if we are in the destructor..
@@ -475,14 +473,16 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor,
dd->cleanupNodesOnShutdown();
} else {
QSG_RT_DEBUG(" - persistent SG, avoiding cleanup");
- gl->doneCurrent();
+ if (current)
+ gl->doneCurrent();
return;
}
sgrc->invalidate();
QCoreApplication::processEvents();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
- gl->doneCurrent();
+ if (current)
+ gl->doneCurrent();
QSG_RT_DEBUG(" - invalidated scenegraph..");
if (wipeGL) {
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 997d58de0f..99d1d60258 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -185,11 +185,9 @@ Atlas::~Atlas()
void Atlas::invalidate()
{
- Q_ASSERT(QOpenGLContext::currentContext());
- if (m_texture_id) {
+ if (m_texture_id && QOpenGLContext::currentContext())
glDeleteTextures(1, &m_texture_id);
- m_texture_id = 0;
- }
+ m_texture_id = 0;
}
Texture *Atlas::create(const QImage &image)