-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
jfx12
-
x86_64
-
windows_10
A DESCRIPTION OF THE PROBLEM :
The method Node.getPseudoClassStates() returns an umodifiable wrapper of a Nodes active pseudo-class states. Since every call creates a new wrapper instance, the caller needs to save a strong reference to the result of the method. Otherwise the wrapper will eventually be collected by the GC and therefore listeners added to this wrapper will no longer receive events from the underlying collection.
This behavior is surprising because similar API like TableView.getVisibleLeafColumns() will always return the same unmodifiable wrapper.
CUSTOMER SUBMITTED WORKAROUND :
Callers can manage a strong reference to a wrapper returned by Node.getPseudoClassStates() to prevent premature garbage collection.
FREQUENCY : always
The method Node.getPseudoClassStates() returns an umodifiable wrapper of a Nodes active pseudo-class states. Since every call creates a new wrapper instance, the caller needs to save a strong reference to the result of the method. Otherwise the wrapper will eventually be collected by the GC and therefore listeners added to this wrapper will no longer receive events from the underlying collection.
This behavior is surprising because similar API like TableView.getVisibleLeafColumns() will always return the same unmodifiable wrapper.
CUSTOMER SUBMITTED WORKAROUND :
Callers can manage a strong reference to a wrapper returned by Node.getPseudoClassStates() to prevent premature garbage collection.
FREQUENCY : always
- duplicates
-
JDK-8214699 Node.getPseudoClassStates must return the same instance on every call
- Resolved