Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.2, 6.5
-
None
-
-
46842ec7c (dev), edd5fafa5 (6.6), 9445aaf96 (tqtc/lts-6.2), 988a30c46 (6.5)
Description
Simple qml bindings may fail to re-evaluate when they reference an object that has just been created.
For example in the below image I have a simple qml application with two buttons. The first button either creates a Rectangle object and sets it's width to 1200 or deletes the previously created Rectangle. The second button simply prints the width of the Rectangle if it exists.
If I spam the first button (see in the attached gif) you should see that the buttons text sometimes shows 1200 (CORRECT) but also sometimes shows 0 (INCORRECT). This appears to be totally random, sometimes it happens right away, sometimes it takes 30+ clicks but it does eventually happen.
The binding that is not re-evaluating is simply:
text: root.rectItem?.width ?? "Create Object"
I.e. display the width of rectItem if it exists.
If I click button 2 while button 1 shows "0" it will correctly console.log the width of the rectItem as 1200.
I have attached the full qml example for reference.