diff options
author | Aleksei Ilin <a.ilin@outlook.com> | 2017-08-08 12:44:42 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-08-15 12:50:07 +0000 |
commit | 3513995d8fde7f002977275463fcea1b86f4a693 (patch) | |
tree | 4a2e22ab83e6d57ecb5a2fe3381e1f7cd9e00d8a /tests | |
parent | 1b21b73e89942d567c90a17a3bf7a7ecae3de258 (diff) |
Fix crash in QQuickAnimatedImage
Check d->_movie pointer before dereferencing
Task-number: QTBUG-62380
Change-Id: I62314c7c0d4a7e41fa6f8c4629d16f30d6036156
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry-picked from fc3ecd2522deb3f6d8d48b66dbd89402e1ab4b53)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qmltest/animatedimage/tst_animatedimage.qml | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qmltest/animatedimage/tst_animatedimage.qml b/tests/auto/qmltest/animatedimage/tst_animatedimage.qml index 6ddd0e3024..c7e0aa2711 100644 --- a/tests/auto/qmltest/animatedimage/tst_animatedimage.qml +++ b/tests/auto/qmltest/animatedimage/tst_animatedimage.qml @@ -114,6 +114,44 @@ Item { fillMode: AnimatedImage.TileHorizontally } + Loader { + id: raceConditionLoader + active: false + anchors.fill: parent + + sourceComponent: ListView { + anchors.fill: parent + model: 5000 + delegate: Item { + height: 10 + width: parent.width + Text { + anchors.fill: parent + text: index + } + AnimatedImage { + anchors.fill: parent + source: "http://127.0.0.1/some-image-url.gif" + Component.onCompleted: source = ""; + } + } + + function scrollToNext() { + currentIndex = currentIndex + 30 < model ? currentIndex + 30 : model; + positionViewAtIndex(currentIndex, ListView.Beginning); + if (currentIndex >= model) + raceConditionLoader.active = false; + } + + property Timer timer: Timer { + interval: 10 + repeat: true + onTriggered: parent.scrollToNext() + Component.onCompleted: start() + } + } + } + TestCase { name: "AnimatedImage" @@ -216,5 +254,10 @@ Item { compare(tileModes3.fillMode, AnimatedImage.TileHorizontally) } + function test_crashRaceCondition_replyFinished() { + raceConditionLoader.active = true; + tryCompare(raceConditionLoader, "active", false); + } + } } |