PopupControl.skin.setSkin(Skin) discards a new Skin of the same class as the existing Skin, but fails to call Skin.dispose(). That fails to perform the cleanup the discarded Skin's dispose() method should have done.
This issue is the same asJDK-8276056 but for PopupControl.
EXAMPLE:
Note that 'DISPOSE CALLED' is never printed and 'popupControl.getSkin() == skin2' does not evaluate to true, although we would expect it.
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.control.PopupControl;
import javafx.scene.control.Skin;
import javafx.stage.Stage;
public class SkinBug extends Application {
@Override
public void start(Stage stage) {
PopupControl popupControl = new PopupControl();
CustomSkin skin1 = new CustomSkin();
popupControl.setSkin(skin1);
CustomSkin skin2 = new CustomSkin();
popupControl.setSkin(skin2);
System.out.println(popupControl.getSkin() == skin2);
}
public static void main(String[] args) {
launch(args);
}
private class CustomSkin implements Skin<PopupControl> {
@Override
public PopupControl getSkinnable() {
return null;
}
@Override
public Node getNode() {
return null;
}
@Override
public void dispose() {
System.out.println("DISPOSE CALLED");
}
}
}
This issue is the same as
EXAMPLE:
Note that 'DISPOSE CALLED' is never printed and 'popupControl.getSkin() == skin2' does not evaluate to true, although we would expect it.
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.control.PopupControl;
import javafx.scene.control.Skin;
import javafx.stage.Stage;
public class SkinBug extends Application {
@Override
public void start(Stage stage) {
PopupControl popupControl = new PopupControl();
CustomSkin skin1 = new CustomSkin();
popupControl.setSkin(skin1);
CustomSkin skin2 = new CustomSkin();
popupControl.setSkin(skin2);
System.out.println(popupControl.getSkin() == skin2);
}
public static void main(String[] args) {
launch(args);
}
private class CustomSkin implements Skin<PopupControl> {
@Override
public PopupControl getSkinnable() {
return null;
}
@Override
public Node getNode() {
return null;
}
@Override
public void dispose() {
System.out.println("DISPOSE CALLED");
}
}
}
- relates to
-
JDK-8276056 Control.skin.setSkin(Skin) fails to call dispose() on discarded Skin
- Resolved
-
JDK-8096194 [CSS] CSS Error when placing labels into a Tooltip
- Resolved
- links to
-
Commit openjdk/jfx/aac2df16
-
Review(master) openjdk/jfx/1331