On Tue, 5 Mar 2024 08:20:03 GMT, Johan Vos <j...@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: > > Update > modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/GlassSystemMenu.java > > Co-authored-by: John Hendrikx <john.hendrikx+git...@gmail.com>
Answering my own questions... The existing for loop quoted above actually loops while `>= 1` rather than `>= 0`: for (int index = existingSize - 1; index >= 1; index--) { so indeed the last menu would be held. And I think that the answer to my other question (why is this even being used on Linux) is that the `createAndRefocusMenuBarStage()` method in the newly added test is calling `GlassSystemMenuBar::createMenuBar` unconditionally (via the Shim), when the actual logic in WindowStage qualifies by whether or not system menu is supported (which it only is for Mac). So I think this is a test bug. I might recommend adding something like the following to the test: assumeTrue(glassSystemMenu.isSupported()); ------------- PR Comment: https://git.openjdk.org/jfx/pull/1283#issuecomment-1979732823