just to keep track, a failing test below.
Didn't dig, just verified that not/removing the listener to selectedItem in dispose (as suggested in fix forJDK-8241737) does not make a difference here.
public static class TabPaneSkin1 extends TabPaneSkin {
public TabPaneSkin1(TabPane control) {
super(control);
}
}
/**
* memory leak when replacing skin
*/
@Test
public void testTabPaneSkin() {
TabPane control = new TabPane();
ObservableList<String> data = FXCollections.observableArrayList("Apple", "Orange", "Banana");
data.forEach(text -> control.getTabs().add(new Tab(text)));
showControl(control);
WeakReference<?> weakRef = new WeakReference<>(control.getSkin());
control.setSkin(new TabPaneSkin1(control));
attemptGC(weakRef, 10);
assertNull("skin must be gc'ed", weakRef.get());
}
Didn't dig, just verified that not/removing the listener to selectedItem in dispose (as suggested in fix for
public static class TabPaneSkin1 extends TabPaneSkin {
public TabPaneSkin1(TabPane control) {
super(control);
}
}
/**
* memory leak when replacing skin
*/
@Test
public void testTabPaneSkin() {
TabPane control = new TabPane();
ObservableList<String> data = FXCollections.observableArrayList("Apple", "Orange", "Banana");
data.forEach(text -> control.getTabs().add(new Tab(text)));
showControl(control);
WeakReference<?> weakRef = new WeakReference<>(control.getSkin());
control.setSkin(new TabPaneSkin1(control));
attemptGC(weakRef, 10);
assertNull("skin must be gc'ed", weakRef.get());
}
- blocks
-
JDK-8241364 ☂ Cleanup skin implementations to allow switching
- Open