For some reason the `skinProperty` did not allow to set a new skin when it is 
the same class as the previous one.
This leads to multiple issues:
1. When creating a new skin (same class as previous), the skin will likely 
install listener but is then rejected when setting it due to the `skinProperty` 
class constraint
-> `PopupControl` is in a weird state as the current skin was not disposed 
since it is still set, although we already created and 'set' a new skin
2. A skin of the same class can behave differently, so it is not really valid 
to reject a skin just because it is the same class as the previous
-> Just imagine we have the following skin class

class MyCustomSkin<C extends PopupControl> extends Skin<C> {
    public MyCustomSkin(C skinnable, boolean someFlag) { ... }
}

Now if we would change the skin of the `PopupControl` two times like this:

popup.setSkin(new MyCustomSkin(popup, true));
popup.setSkin(new MyCustomSkin(popup, false));

The second time the skin will be rejected as it is the same class, although I 
may changed the skin behaviour, in this case demonstrated by a boolean flag for 
showing purposes.

This is the same issue and fix as done for `Control` in 
[JDK-8276056](https://bugs.openjdk.org/browse/JDK-8276056) (PR: 
https://github.com/openjdk/jfx/pull/806)

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

Commit messages:
 - JDK-8323615: PopupControl.skin.setSkin(Skin) fails to call dispose() on 
discarded Skin

Changes: https://git.openjdk.org/jfx/pull/1331/files
 Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1331&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8323615
  Stats: 42 lines in 2 files changed: 28 ins; 12 del; 2 mod
  Patch: https://git.openjdk.org/jfx/pull/1331.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1331/head:pull/1331

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

Reply via email to