RFR: 8319779: SystemMenu: memory leak due to listener never being removed [v16]
Jose Pereda
jpereda at openjdk.org
Thu Jun 13 10:48:23 UTC 2024
On Thu, 9 May 2024 19:48:19 GMT, Johan Vos <jvos at openjdk.org> wrote:
>> A listener was added but never removed.
>> This patch removes the listener when the menu it links to is cleared. Fix for https://bugs.openjdk.org/browse/JDK-8319779
>
> Johan Vos has updated the pull request incrementally with one additional commit since the last revision:
>
> Add more type info
I've tested on macOS, and tests pass now, and fail without the changes from this PR.
I've left some comments, but once addressed, I'll re-approve.
modules/javafx.graphics/src/shims/java/com/sun/javafx/tk/quantum/GlassSystemMenuShim.java line 37:
> 35:
> 36: private GlassSystemMenu gsm;
> 37: final ArrayList<WeakReference<Menu>> uncollectedMenus = new ArrayList<>();
this can be private?
modules/javafx.graphics/src/shims/java/com/sun/javafx/tk/quantum/GlassSystemMenuShim.java line 54:
> 52: protected void setMenuBindings(final Menu glassMenu, final MenuBase mb) {
> 53: super.setMenuBindings(glassMenu, mb);
> 54: uncollectedMenus.add(new WeakReference(glassMenu));
Add `<>` to avoid raw use of `WeakReference`
tests/system/src/test/java/test/com/sun/javafx/tk/quantum/SystemMenuBarTest.java line 289:
> 287: public void testJDK8309935() {
> 288: MenuBar menuBar = new MenuBar();
> 289: AtomicReference<Throwable> throwableRef = new AtomicReference();
Add missing `<>` to avoid raw use of `AtomicReference`
-------------
Marked as reviewed by jpereda (Reviewer).
PR Review: https://git.openjdk.org/jfx/pull/1283#pullrequestreview-2115396776
PR Review Comment: https://git.openjdk.org/jfx/pull/1283#discussion_r1637974242
PR Review Comment: https://git.openjdk.org/jfx/pull/1283#discussion_r1637973453
PR Review Comment: https://git.openjdk.org/jfx/pull/1283#discussion_r1637980139
More information about the openjfx-dev
mailing list