Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
4.7.2
-
None
Description
The following code produces different result on different runs:
import Qt 4.7 Rectangle { width: 100 height: 62 property int a property int b : a property int c : a + b property bool d : c === 1 onAChanged: console.log("a: " + a) onBChanged: console.log("b: " + b) onCChanged: console.log("c: " + c) onDChanged: console.log("d: " + d) Component.onCompleted: { a = 1; Qt.quit(); } }
One would easily be fooled to think property d never becomes true just by looking at the code, but sometimes the "d" property is transiently true, depending on the evaluation order of the bindings which is not fixed from run to run. So, all qml apps must be written so that the code is robust against changes in evaluation order, a fact that is probably mentioned in some documentation. However, looking at the above example, how is it possible to ensure the application does not implicitly rely on the evaluation order if logic is more involved?
Attachments
Issue Links
- is replaced by
-
QTBUG-11712 all bindings should be updated before any onXXXChanged handler run
- Open