On Wed, 16 Apr 2025 17:05:55 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> A listener that is added to `Parent.needsLayoutProperty()` may see a wrong 
>> value when calling `Parent.isNeedsLayout()` from the callback. The fix is to 
>> apply the value before notifying the listeners.
>
> 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()`.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1781#discussion_r2047484643

Reply via email to