RFR: 8246202: ChoiceBoxSkin: misbehavior on switching skin, part 2

Jeanette Winzenburg fastegal at openjdk.java.net
Wed Oct 14 14:19:13 UTC 2020


On Wed, 14 Oct 2020 12:08:59 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> issue is a listener in ChoiceBoxSkin that wasn't removed (forgotten in my first cleanup ;)
>> 
>> Removed, un-ignored test that failed/passed before/after the fix
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/ChoiceBoxSkin.java line 209:
> 
>> 207:     /** {@inheritDoc} */
>> 208:     @Override public void dispose() {
>> 209:         if (getSkinnable() == null) return;
> 
> This will short-circuit the rest of the method, including the call to `super.dispose()`, if `getSkinnable()` is null.
> Are there any cases where this might miss some needed cleanup?

that's intentional - the usual pattern to make dispose cope with repeated calls (something we learned in
[JDK-8244112](https://bugs.openjdk.java.net/browse/JDK-8244112): the ony valid path to having skinnable null is a
previous call to dispose (which is allowed by client code) in which we already did all clean-up.

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

PR: https://git.openjdk.java.net/jfx/pull/320


More information about the openjfx-dev mailing list