diff options
author | Gunnar Sletta <[email protected]> | 2014-04-11 16:21:54 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-04-23 09:10:18 +0200 |
commit | 4e4228e0b1c01edada84d82746e3360aeffeb037 (patch) | |
tree | f39531393885e6940c6e4940f202c1a40a104f13 /src/quick/scenegraph/qsgthreadedrenderloop.cpp | |
parent | 964dcdfb7bc106696b4be12b7f71ba52f8448973 (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 <[email protected]>
Reviewed-by: Sean Harmer <[email protected]>
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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) { |