summaryrefslogtreecommitdiff
path: root/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-10-17 13:04:47 +0200
committerUlf Hermann <ulf.hermann@qt.io>2017-10-24 09:00:52 +0000
commitec00272f749972c49d4eaf858a57c38a5bf30c8b (patch)
tree3cf0806e56c7ca994332e17d81913d8487bd779d /tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
parentdadaa47844f36ba2e598a1d44cfff0cb16384510 (diff)
downloadqtdeclarative-ec00272f749972c49d4eaf858a57c38a5bf30c8b.tar.gz
QQuickAnimatorProxyJob: Disconnect from window when unsetting it
Otherwise we may get called back when the window's scene graph is ready, but we don't have a controller anymore then. This leads to a crash. Change-Id: I8075619e1fd3c69ca0f7d0b1d72952b8cc5040f8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickanimations/tst_qquickanimations.cpp')
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index fbd6c9c97e..4a7a77416a 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -35,6 +35,7 @@
#include <QtQuick/private/qquickitemanimation_p_p.h>
#include <QtQuick/private/qquicktransition_p.h>
#include <QtQuick/private/qquickanimation_p.h>
+#include <QtQuick/private/qquickanimatorjob_p.h>
#include <QtQuick/private/qquickpathinterpolator_p.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QEasingCurve>
@@ -103,6 +104,7 @@ private slots:
void defaultPropertyWarning();
void pathSvgAnimation();
void pathLineUnspecifiedXYBug();
+ void unsetAnimatorProxyJobWindow();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -1567,6 +1569,22 @@ void tst_qquickanimations::pathLineUnspecifiedXYBug()
QCOMPARE(redRect->y(), qreal(0));
}
+void tst_qquickanimations::unsetAnimatorProxyJobWindow()
+{
+ QQuickWindow window;
+ QQuickItem item(window.contentItem());
+ QQuickAbstractAnimation animation(&item);
+ QAbstractAnimationJob *job = new QAbstractAnimationJob;
+ QQuickAnimatorProxyJob proxy(job, &animation);
+ QQuickItem dummy;
+ item.setParentItem(&dummy);
+ QSignalSpy spy(&window, SIGNAL(sceneGraphInitialized()));
+ window.show();
+ if (spy.count() < 1)
+ spy.wait();
+ QCOMPARE(proxy.job().data(), job);
+}
+
QTEST_MAIN(tst_qquickanimations)
#include "tst_qquickanimations.moc"