diff options
author | Glenn Watson <glenn.watson@nokia.com> | 2012-03-12 13:20:22 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-13 02:02:49 +0100 |
commit | be8675ab01132ffb03b81cc81842775d6a8fa3f9 (patch) | |
tree | b7126d1fc348b8fe7393ebf646d5c92fa40c1cbc /tests/auto/quick/qquickrepeater/data | |
parent | fc5ddb181896d3a364c046ae21b61283412fc722 (diff) |
Change repeater item to handle model being deleted.
The repeater item previously stored a raw QObject pointer in
a variant. When this pointer was a dynamic list model element
that was deleted, the variant would continue to hold a stale
pointer. Change repeater to use a guard object to hold the model
when it is a QObject. Continue to use a variant to hold models
that are not based on QObject to maintain same semantics.
Change-Id: Ie100947132923803263c725e86efa68206382f12
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickrepeater/data')
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml b/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml new file mode 100644 index 0000000000..0280df0620 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +Item { + ListModel { + id: lm; + } + + Component.onCompleted: { + lm.append({ subModel: [ {d:0} ] }); + rep.model = lm.get(0).subModel; + rep.model; + lm.remove(0); + rep.model; + } + + Repeater { + objectName: "rep" + id: rep + } +} |