-
Bug
-
Resolution: Fixed
-
P4
-
jfx16
first cleanup rounds (JDK-8256821 for TreeViewSkin, JDK-8246195 for ListViewSkin) only removed references from the flow to the skin: this seemed to fix memory leaks (and side-effects) for both - but not completely for TreeView, still failing when skin is replaced while the tree is in a scene:
@Test
public void testMemoryLeakShowAlternativeSkin() {
showControl();
Skin<?> replacedSkin = replaceSkin(control);
WeakReference<?> weakRef = new WeakReference<>(replacedSkin);
replacedSkin = null;
// beware: this is important - we might get false leaks without!
Toolkit.getToolkit().firePulse();
attemptGC(weakRef);
assertEquals("Skin must be gc'ed", null, weakRef.get());
}
Since then, we learned a bit - in particular to remove all direct children that the skin has added, here that would be the flow. Doing so lets the test pass.
Aside: the same test for ListViewSkin passes. Which was puzzling, given everything else related to the flow is the exact same - or so it looks: the difference is the default cellFactory - in listViewSkin it's a static method, in treeViewSkin it's an instance method (keeping an implicit reference to the skin?).
@Test
public void testMemoryLeakShowAlternativeSkin() {
showControl();
Skin<?> replacedSkin = replaceSkin(control);
WeakReference<?> weakRef = new WeakReference<>(replacedSkin);
replacedSkin = null;
// beware: this is important - we might get false leaks without!
Toolkit.getToolkit().firePulse();
attemptGC(weakRef);
assertEquals("Skin must be gc'ed", null, weakRef.get());
}
Since then, we learned a bit - in particular to remove all direct children that the skin has added, here that would be the flow. Doing so lets the test pass.
Aside: the same test for ListViewSkin passes. Which was puzzling, given everything else related to the flow is the exact same - or so it looks: the difference is the default cellFactory - in listViewSkin it's a static method, in treeViewSkin it's an instance method (keeping an implicit reference to the skin?).
- blocks
-
JDK-8241364 ☂ Cleanup skin implementations to allow switching
- Open
- relates to
-
JDK-8246195 ListViewSkin/Behavior: misbehavior on switching skin
- Resolved
-
JDK-8256821 TreeViewSkin/Behavior: misbehavior on switching skin
- Resolved