On Mon, 23 Mar 2020 23:40:39 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
> > > Using a WeakListener is certainly easier, but runs the risk of the listener > being removed too early and not cleaning up > after itself. I'm not suggesting that's the case here, but it is worth > looking at. The listener does not get early GCed here. I did verify this by creating large number of `ButtonSkin`s. The latest `ButtonSkin` set on the `Button` is never GCed > > >The one thing I would ask you to take a look at is whether it would matter if >the old skin didn't call >`setDefaultButton(oldScene, false)` when removed (and similarly >`setCancelButton`). This seems to be a bigger issue. If we create multiple `ButtonSkin`s for a given `Button`, then all the `ButtonSkin` register listeners with the properties of that `Button`. And it results in various listeners being added to same property of the `Button`. and this should be a common issue across all skins. ------------- PR: https://git.openjdk.java.net/jfx/pull/147