On Wed, 5 Feb 2020 23:29:50 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> `ListView` does not get GCed because `SelectedItemsReadOnlyObservableList` 
>> adds a `ListChangeListener` to the (`ObservableList`) items of `ListView`.
>> 
>> Adding a `WeakListChangeListener` instead of `ListChangeListener` fixes the 
>> issue.
>> 
>> Added a unit test and verified that existing tests do not fail due to this 
>> change.
> 
> Presuming that using a weak reference causes no other issues, the fix looks 
> fine and will resolve the leak. How confident are you that there are no cases 
> where the listener might be prematurely garbage collected?

> 
> 
> How confident are you that there are no cases where the listener might be 
> prematurely garbage collected?

The listener is added by `ListViewBitSetSelectionModel`. The selection model is 
set only once for a `ListView` and we do not unset it. So the change looks very 
safe to me.

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

PR: https://git.openjdk.java.net/jfx/pull/84

Reply via email to