On Wed, 11 Jan 2023 09:22:07 GMT, Florian Kirmaier <fkirma...@openjdk.org> 
wrote:

>> This PR fixes the leak in the mac system menu bar.
>> 
>> Inside the native code, NewGlobalRef is called for the callable.
>> Which makes it into a "GC-Root" until DeleteGlobalRef is called.
>> 
>> The DeleteGlobalRef is never called for the MenuEntry, if it's removed from 
>> the menu without removing it's callable.
>> This PR adds logic, whether the Menu is inserted. If it's not inserted in a 
>> Menu anymore, then DeleteGlobalRef is called, by calling `_setCallback` with 
>> the callable "null".
>> 
>> The unit test verifies, that this bug happened without this change, but no 
>> longer happens with this change.
>
> Florian Kirmaier has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   JDK-8299423
>   Added null check before using the callback

tests/system/src/test/java/test/javafx/scene/control/SystemMenuBarTest.java 
line 36:

> 34: import javafx.scene.layout.VBox;
> 35: import javafx.stage.Stage;
> 36: import org.junit.*;

Since this a new class, can you use the JUnit5 API?

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

PR: https://git.openjdk.org/jfx/pull/987

Reply via email to