aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgthreadedrenderloop.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-03-17 09:32:34 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-03-17 09:52:19 +0100
commitfb0cb17cb55c9ed44b7fcbc92efcc244e96c9b36 (patch)
tree2ba609d4c6416036d3cb5f345a6c1125e0f105d6 /src/quick/scenegraph/qsgthreadedrenderloop.cpp
parent4dc68ba888c7dbb7bd16455991f6d5814df13cba (diff)
parent84155a8e1a6250d3e4b0949a42464eee5dfef537 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 460f92edd7..e1a54810b7 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -490,6 +490,14 @@ void QSGRenderThread::sync(bool inExpose)
bool current = false;
if (windowSize.width() > 0 && windowSize.height() > 0)
current = gl->makeCurrent(window);
+ // Check for context loss.
+ if (!current && !gl->isValid()) {
+ QQuickWindowPrivate::get(window)->cleanupNodesOnShutdown();
+ sgrc->invalidate();
+ current = gl->create() && gl->makeCurrent(window);
+ if (current)
+ sgrc->initialize(gl);
+ }
if (current) {
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
bool hadRenderer = d->renderer != 0;
@@ -571,6 +579,12 @@ void QSGRenderThread::syncAndRender()
bool current = false;
if (d->renderer && windowSize.width() > 0 && windowSize.height() > 0)
current = gl->makeCurrent(window);
+ // Check for context loss.
+ if (!current && !gl->isValid()) {
+ // Cannot do anything here because gui is not locked. Request a new
+ // sync+render round on the gui thread and let the sync handle it.
+ QCoreApplication::postEvent(window, new QEvent(QEvent::Type(QQuickWindowPrivate::FullUpdateRequest)));
+ }
if (current) {
d->renderSceneGraph(windowSize);
if (profileFrames)
@@ -694,6 +708,11 @@ QSGThreadedRenderLoop::QSGThreadedRenderLoop()
m_animation_driver->install();
}
+QSGThreadedRenderLoop::~QSGThreadedRenderLoop()
+{
+ delete sg;
+}
+
QSGRenderContext *QSGThreadedRenderLoop::createRenderContext(QSGContext *sg) const
{
return sg->createRenderContext();