RFR: 8318841: macOS: Memory leak with MenuItem when Menu.useSystemMenuBar(true) is used [v6]

Kevin Rushforth kcr at openjdk.org
Fri Nov 10 13:59:14 UTC 2023


On Fri, 10 Nov 2023 09:58:21 GMT, Johan Vos <jvos at openjdk.org> wrote:

>> tests/system/src/test/java/test/javafx/stage/SystemMenuBarTest.java line 164:
>> 
>>> 162:                     });
>>> 163:                 }
>>> 164:                 Platform.runLater( () -> {
>> 
>> Why is `Platform.runLater` needed here? To wait until the last `Platform.runLater` in the for loop ends? Is it guaranteed that it will be called only after the previous one ends? 
>> 
>> Minor: remove unneeded white space: `Platform.runLater(() -> {`
>
> No, it is needed because we want to give the JavaFX platform the opportunity to do "whatever is needed" after the last runLater() is done. Hence, we put what we want to do on the Runnable queue of the FX thread, so that we don't depend on internals.

This makes sense. To answer one of Jose's questions:

> Is it guaranteed that it will be called only after the previous one ends?

Yes, this is specified behavior of `Platform::runLater`.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1277#discussion_r1389427353


More information about the openjfx-dev mailing list