Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9
-
None
Description
Given something like:
Binding { value: some_obj.val(); when: some_obj != null }
One would expect that the 'when' property takes priority, and prevents the 'value' prop from evaluating. In reality, it doesn't, which leads to runtime errors.
It isn't always possible to rewrite the value expression in such a way that works as desired. For instance, in the above, I want to keep a cached version of some_obj.val, even if some_obj isn't around anymore. This essentially makes it impossible to use Binding for this case.
Workaround until this is fixed (works, but rather ugly):
property var intermediate: some_obj ? some_obj.val() : undefined;
property var final
onIntermediateChanged: { if (intermediate) { final = intermediate; } }