On Mon, 15 Jun 2026 13:48:26 GMT, Michael Strauß <[email protected]> wrote:
>>> I think you're arguing that it's safer >> >> Yeah, that's what I was thinking. >> I just wanted to make sure we weren't overlooking anything regarding memory >> leaks (And the fact that setting fields to `null` seems to be a recurring >> pattern in JavaFX Skins). >> But I checked it using `JMemoryBuddy` and manually, and everything looks >> fine! >> Sorry for the confusion, and thanks for the explanation. >> >>> I'm not sure whether we're on the same page here. There's no possibility to >>> reuse a SkinBase-based skin other than to implement it incorrectly >> >> Right. >> I was referring to skins derived from `Skin` directly, since they could be >> programmed so that `dispose` removes the inner working and `install` >> reinstalls them. >> The class that comes closest to this and might work - assuming the logic >> resides in `install` instead - is JavaFX's `InputFieldSkin`. >> >> But that has nothing to do with this PR. I was just wondering if it might >> make sense at some point to allow the reuse of all JavaFX skins, since we >> already have the necessary architecture in place. > >> Right. I was referring to skins derived from `Skin` directly, since they >> could be programmed so that `dispose` removes the inner working and >> `install` reinstalls them. The class that comes closest to this and might >> work - assuming the logic resides in `install` instead - is JavaFX's >> `InputFieldSkin`. >> >> But that has nothing to do with this PR. I was just wondering if it might >> make sense at some point to allow the reuse of all JavaFX skins, since we >> already have the necessary architecture in place. > > I will say that it seems a bit weird that _you_ create the skin instance, but > the _control_ disposes it. I think it would have been a better design if: > 1. The control creates the skin instance on your behalf, and then disposes it > if you request another skin, or > 2. you create the skin instance, but you are also responsible for disposal. That is a good point. I've only seen one project that tried to reuse skins (though it didn't work out), so maybe that isn't a practical solution after all (changing the skin if the table is editable or not). It just occurred to me, but it has little to do with the PR really and probably deserves its own mailing list post - if it's even necessary, since there are other issues we should tackle first. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2177#discussion_r3415854247
