diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-08-05 14:53:34 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-08-08 09:58:00 +0200 |
commit | e823bb5aee09c8a9f4a11bfd9ab6c68d2a77e93e (patch) | |
tree | 2e75f21f09597681b4f2717410c352689adc7fb9 /src/quick/items | |
parent | f14f713c2fd42e94abe55b8fc1b4dabffaa15fda (diff) |
Invalidate the scenegraph properly in the rendercontrol
Taking the persistent flags from the QQuickWindow was a bad idea. These
are not applicable to the case when an application drives the scene via
QQuickRenderControl. Once stop() is called, all resources must be
released since the context itself will typically be destroyed afterwards.
This is a backport of 0b0bb319578bb2e2eced3a80ce3876a4408b72a7 in dev.
On top of this, stop() becomes invalidate() since the original
invalidate() function is never used by anyone. This naming is much cleaner
and is consistent with QSGContext and friends.
Task-number: QTBUG-40505
Task-number: QTBUG-40435
Change-Id: I398f1bda31f335c3508b238f0328305d3cd79ffd
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickrendercontrol.cpp | 17 | ||||
-rw-r--r-- | src/quick/items/qquickrendercontrol_p.h | 1 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index 2842d7e933..e28669ceb3 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -123,12 +123,6 @@ void QQuickRenderControl::initialize(QOpenGLContext *gl) d->rc->initialize(gl); } -void QQuickRenderControl::invalidate() -{ - Q_D(QQuickRenderControl); - d->rc->invalidate(); -} - /*! This function should be called as late as possible before sync(). In a threaded scenario, rendering can happen in parallel with this function. @@ -165,7 +159,7 @@ bool QQuickRenderControl::sync() Stop rendering and release resources. This function is typically called when the window is hidden. Requires a current context. */ -void QQuickRenderControl::stop() +void QQuickRenderControl::invalidate() { Q_D(QQuickRenderControl); if (!d->window) @@ -175,10 +169,11 @@ void QQuickRenderControl::stop() cd->fireAboutToStop(); cd->cleanupNodesOnShutdown(); - if (!cd->persistentSceneGraph) { - d->rc->invalidate(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); - } + // We must invalidate since the context can potentially be destroyed by the + // application right after returning from this function. Invalidating is + // also essential to allow a subsequent initialize() to succeed. + d->rc->invalidate(); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); } /*! diff --git a/src/quick/items/qquickrendercontrol_p.h b/src/quick/items/qquickrendercontrol_p.h index cc30e37724..d8d5b09a9c 100644 --- a/src/quick/items/qquickrendercontrol_p.h +++ b/src/quick/items/qquickrendercontrol_p.h @@ -74,7 +74,6 @@ public: void polishItems(); void render(); bool sync(); - void stop(); QImage grab(); |