aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@sletta.org>2015-07-02 15:54:43 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-07-04 19:59:52 +0000
commit982fa2225b7d69181344a00816cad19042a922e6 (patch)
tree3ccb505de40e103b48cbefcc85ed5ab76d5980c5 /src/quick
parenteeee9f1466ffaf17f81d635c2e43dca76ce5b021 (diff)
Delete QQuickWindow's animator driver at the right time.
For the non-threaded renderloops, we there might be a timer firing before the animationController is cleaned up through deleteLater() which will then reference the deleted QQuickWindow. Rely instead on direct and explicit cleanup at the right time in each render loop. Change-Id: Id81daddae78ce3922d6a932fb21200f2dc7955bb Task-number: QTBUG-33723 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickwindow.cpp1
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp3
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp5
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp6
4 files changed, 11 insertions, 4 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 84b585e3b5..4238787cc8 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1112,7 +1112,6 @@ QQuickWindow::~QQuickWindow()
{
Q_D(QQuickWindow);
- d->animationController->deleteLater();
if (d->renderControl) {
QQuickRenderControlPrivate::get(d->renderControl)->windowDestroyed();
} else if (d->windowManager) {
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index ec9c3c39f9..4d3f34c71c 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -34,6 +34,7 @@
#include "qsgrenderloop_p.h"
#include "qsgthreadedrenderloop_p.h"
#include "qsgwindowsrenderloop_p.h"
+#include <private/qquickanimatorcontroller_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QTime>
@@ -305,6 +306,8 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
} else if (gl && window == gl->surface() && current) {
gl->doneCurrent();
}
+
+ delete d->animationController;
}
void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 56637387df..2cebbaf484 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -451,11 +451,12 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor,
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- cleanup without an OpenGL context";
}
+ QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window);
+
QQuickShaderEffectMaterial::cleanupMaterialCache();
// The canvas nodes must be cleaned up regardless if we are in the destructor..
if (wipeSG) {
- QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window);
dd->cleanupNodesOnShutdown();
} else {
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- persistent SG, avoiding cleanup";
@@ -467,6 +468,8 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor,
sgrc->invalidate();
QCoreApplication::processEvents();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ if (inDestructor)
+ delete dd->animationController;
if (current)
gl->doneCurrent();
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- invalidating scene graph";
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index c571e60018..7fd9651618 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -32,7 +32,6 @@
****************************************************************************/
#include "qsgwindowsrenderloop_p.h"
-
#include <QtCore/QCoreApplication>
#include <QtCore/QLibraryInfo>
#include <QtCore/QThread>
@@ -47,8 +46,8 @@
#include <QtQuick/QQuickWindow>
#include <private/qquickprofiler_p.h>
-
#include <private/qquickshadereffectnode_p.h>
+#include <private/qquickanimatorcontroller_p.h>
QT_BEGIN_NAMESPACE
@@ -219,6 +218,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
hide(window);
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
+
bool current = false;
QScopedPointer<QOffscreenSurface> offscreenSurface;
if (m_gl) {
@@ -245,6 +245,8 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
} else if (m_gl && current) {
m_gl->doneCurrent();
}
+
+ delete d->animationController;
}
bool QSGWindowsRenderLoop::anyoneShowing() const