RFR: 8294589: MenuBarSkin: memory leak when changing skin

Jeanette Winzenburg fastegal at openjdk.org
Tue Oct 4 15:04:36 UTC 2022


On Thu, 29 Sep 2022 23:00:17 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> Fixed memory leak by using weak listeners and making sure to undo everything that has been done to MenuBar/Skin in dispose().

modules/javafx.controls/src/main/java/javafx/scene/control/skin/MenuBarSkin.java line 950:

> 948: 
> 949:         getSkinnable().focusedProperty().addListener(weakMenuBarFocusedPropertyListener);
> 950: 

- listeners on skinnable's properties should be installed via skin api
- skinnable's properties don't change, so no need to add/remove in rebuild - instead do it once

take both with a grain of salt, though, and test if that's really possible :) I think it does - the value is a boolean so the old is always the !current.

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

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


More information about the openjfx-dev mailing list