On Sun, 17 Jul 2022 18:59:22 GMT, Johan Vos <[email protected]> wrote:
>> Do not recalculate total estimated size recursively.
>>
>> In the (unlikely) event that the recalculation triggers a new recalculation
>> (e.g. when the height of a Cell is changed), do not start this recalculation.
>> The cache and cache size may become inconsistent if a recursive calculation
>> is started.
>> This fixes JDK-8290348
>
> Johan Vos has updated the pull request incrementally with one additional
> commit since the last revision:
>
> fix issue with IDE-indicated unused statement
>
I'll make the test more deterministic.
FWIW, the following UI code allows to reproduce the failure (and fix) easier,
but it is UI-based and has a Thread.sleep() so I won't add this in a unit test.
(the generateChildren method is the same as in the unit test)
TreeItem<String> root = new TreeItem<>("Root Node");
root.setExpanded(true);
root.getChildren().addAll(generateChildren(1));
TreeView<String> treeView = new TreeView<>(root);
treeView.scrollTo(100);
Thread t = new Thread() {
@Override public void run() {
try {
Thread.sleep(3000);
Platform.runLater(() -> {
root.getChildren().get(1).setExpanded(false);
});
} catch (Exception e) {
e.printStackTrace();
}
}
};
t.start();
Scene scene = new Scene(treeView, 640, 480);
stage.setScene(scene);
stage.show();
-------------
PR: https://git.openjdk.org/jfx/pull/836