RFR: 8354813: Parent.isNeedsLayout() may return wrong value in property listener
Andy Goryachev
angorya at openjdk.org
Wed Apr 16 18:31:51 UTC 2025
On Wed, 16 Apr 2025 18:23:07 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/Parent.java line 996:
>>
>>> 994: // Needs to be set before needsLayout is updated, as otherwise a listener that
>>> 995: // calls isNeedsLayout() might see the old value.
>>> 996: layoutFlag = flag;
>>
>> This is the right change, but I suspect it might cause regression.
>>
>> The JavaFX entities which call `isNeedsLayout()`:
>>
>> `VirtualFlow::layoutChildren`
>> `VirtualFlow::setCellIndex`
>>
>> We may need to focus on List/Table/Tree/TableViews during testing.
>>
>> (Anecdata: I've seen continuous layout calls in the TableView before)
>
> It's very unlikely to cause regressions, because `needsLayoutProperty()` is not used anywhere in JavaFX. The only thing that is different now is that a listener added to this property will see the correct value when calling `isNeedsLayout()`.
you are probably right, re:javafx. applications might listen to this property, though it's rather unlikely.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1781#discussion_r2047492892
More information about the openjfx-dev
mailing list