aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2022-06-01 16:07:47 +0800
committerMitch Curtis <mitch.curtis@qt.io>2022-06-02 12:46:11 +0800
commit73e173d73cffe95837490a86257cb82d9e150e3a (patch)
treedd006e80979ffec8c1247dadb651d4829ce8a514 /tests
parentce1ec037d12baf9b0bc5c15ab8f280e98f12972f (diff)
DialogButtonBox: test item deletion order
Ensure that items declared before and after the control itself do not cause heap-use-after-frees due to deletion order. Task-number: QTBUG-100396 Pick-to: 6.2 6.3 Change-Id: I3989bf1b9fc64b4ec86f241de2cb8bcd05c2f89d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_dialogbuttonbox.qml82
1 files changed, 82 insertions, 0 deletions
diff --git a/tests/auto/quickcontrols2/controls/data/tst_dialogbuttonbox.qml b/tests/auto/quickcontrols2/controls/data/tst_dialogbuttonbox.qml
index 7d4c5d9e4d..57216ed11c 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_dialogbuttonbox.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_dialogbuttonbox.qml
@@ -528,4 +528,86 @@ TestCase {
control.destroy()
}
}
+
+ Component {
+ id: contentItemDeletionOrder1
+
+ Item {
+ objectName: "parentItem"
+
+ Item {
+ id: item
+ objectName: "contentItem"
+ }
+ DialogButtonBox {
+ objectName: "control"
+ contentItem: item
+ }
+ }
+ }
+
+ Component {
+ id: contentItemDeletionOrder2
+
+ Item {
+ objectName: "parentItem"
+
+ DialogButtonBox {
+ objectName: "control"
+ contentItem: item
+ }
+ Item {
+ id: item
+ objectName: "contentItem"
+ }
+ }
+ }
+
+ function test_contentItemDeletionOrder() {
+ var control1 = createTemporaryObject(contentItemDeletionOrder1, testCase)
+ verify(control1)
+ var control2 = createTemporaryObject(contentItemDeletionOrder2, testCase)
+ verify(control2)
+ }
+
+ Component {
+ id: backgroundDeletionOrder1
+
+ Item {
+ objectName: "parentItem"
+
+ Item {
+ id: item
+ objectName: "backgroundItem"
+ }
+ DialogButtonBox {
+ objectName: "control"
+ background: item
+ }
+ }
+ }
+
+ Component {
+ id: backgroundDeletionOrder2
+
+ Item {
+ objectName: "parentItem"
+
+ DialogButtonBox {
+ objectName: "control"
+ background: item
+ }
+ Item {
+ id: item
+ objectName: "backgroundItem"
+ }
+ }
+ }
+
+ function test_backgroundDeletionOrder() {
+ var control1 = createTemporaryObject(backgroundDeletionOrder1, testCase)
+ verify(control1)
+ var control2 = createTemporaryObject(backgroundDeletionOrder2, testCase)
+ verify(control2)
+ }
}