Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5.1
-
0c50edd6f (dev), d9bfd8d5c (6.5), 60915b00b (6.6)
Description
This issue also affects TestCase.createTemporaryObject()
Code
(attached, adapted from https://github.com/qt/qtdeclarative/tree/v6.4.3/examples/qml/referenceexamples/default )
import QtQuick import People Window { id: root width: 640 height: 480 visible: true Person { id: h0; name: "Bob Jones" } Person { id: g1; name: "Leo Hodges" } Person { id: g2; name: "Jack Smith" } Person { id: g3; name: "Anne Brown" } BirthdayParty { id: party1 host: h0 guests: [g1, g2, g3] } Component { id: partyComp BirthdayParty {} } function announceParty(party: BirthdayParty) { console.log(`${party.host.name} is having ${party.guests.length} guests. They are:`) for (let i = 0; i < party.guests.length; ++i) console.log('\t', party.guests[i].name) } Component.onCompleted: { let party2 = partyComp.createObject(root, { host: h0, guests: [g1, g2, g3] }); announceParty(party1) announceParty(party2) } }
Expected output (Qt 6.2.8)
qml: Bob Jones is having 3 guests. They are: qml: Leo Hodges qml: Jack Smith qml: Anne Brown qml: Bob Jones is having 3 guests. They are: qml: Leo Hodges qml: Jack Smith qml: Anne Brown
Actual output (Qt 6.3.2 and newer)
qml: Bob Jones is having 3 guests. They are: qml: Leo Hodges qml: Jack Smith qml: Anne Brown qml: Bob Jones is having 1 guests. They are: qrc:example.qml:28: TypeError: Cannot read property 'name' of null