On Mon, 20 Nov 2023 08:00:58 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: > > process reviewers comments modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/GlassSystemMenu.java line 189: > 187: > 188: private ListChangeListener<MenuItemBase> createListener(final Menu > glassMenu) { > 189: return (ListChangeListener.Change<? extends MenuItemBase> > change) -> { In this listener, when there are items removed that are `Menu`s, we should also call `clearMenu`: if (i >= 0 && menuItemList.size() > i) { glassMenu.remove(i); + Object item = menuItemList.get(i); + if (item instanceof Menu menu) { + clearMenu(menu); + } } Otherwise, they won't be removed from the new maps. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1283#discussion_r1425062079