Do not crash when one of group animation's children is null
Check if pointer to QQuickAbstractAnimation for which we are setting group is valid. Task-number: QTBUG-34851 Change-Id: Iecb549f080804fd9489f884911fa51892def05a5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
9656078366
commit
e2ca539562
|
@ -1648,7 +1648,8 @@ QQuickAnimationGroup::QQuickAnimationGroup(QQuickAnimationGroupPrivate &dd, QObj
|
|||
|
||||
void QQuickAnimationGroupPrivate::append_animation(QQmlListProperty<QQuickAbstractAnimation> *list, QQuickAbstractAnimation *a)
|
||||
{
|
||||
if (QQuickAnimationGroup *q = qmlobject_cast<QQuickAnimationGroup *>(list->object))
|
||||
QQuickAnimationGroup *q = qmlobject_cast<QQuickAnimationGroup *>(list->object);
|
||||
if (q && a)
|
||||
a->setGroup(q);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
import QtQuick 2.2
|
||||
|
||||
Item {
|
||||
id: root
|
||||
Component.onCompleted: Qt.createQmlObject("import QtQuick 2.2; ParallelAnimation{animations: [null]}", root)
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
import QtQuick 2.2
|
||||
|
||||
Item {
|
||||
id: root
|
||||
Component.onCompleted: Qt.createQmlObject("import QtQuick 2.2; SequentialAnimation{animations: [null]}", root)
|
||||
}
|
|
@ -110,6 +110,7 @@ private slots:
|
|||
void anchorBug();
|
||||
void pathAnimationInOutBackBug();
|
||||
void scriptActionBug();
|
||||
void groupAnimationNullChildBug();
|
||||
};
|
||||
|
||||
#define QTIMED_COMPARE(lhs, rhs) do { \
|
||||
|
@ -1450,6 +1451,31 @@ void tst_qquickanimations::scriptActionBug()
|
|||
QCOMPARE(obj->property("actionTriggered").toBool(), true);
|
||||
}
|
||||
|
||||
//QTBUG-34851
|
||||
void tst_qquickanimations::groupAnimationNullChildBug()
|
||||
{
|
||||
{
|
||||
QQmlEngine engine;
|
||||
|
||||
QQmlComponent c(&engine, testFileUrl("sequentialAnimationNullChildBug.qml"));
|
||||
QQuickItem *root = qobject_cast<QQuickItem*>(c.create());
|
||||
QVERIFY(root);
|
||||
|
||||
delete root;
|
||||
}
|
||||
|
||||
{
|
||||
QQmlEngine engine;
|
||||
|
||||
QQmlComponent c(&engine, testFileUrl("parallelAnimationNullChildBug.qml"));
|
||||
QQuickItem *root = qobject_cast<QQuickItem*>(c.create());
|
||||
QVERIFY(root);
|
||||
|
||||
delete root;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QTEST_MAIN(tst_qquickanimations)
|
||||
|
||||
#include "tst_qquickanimations.moc"
|
||||
|
|
Loading…
Reference in New Issue