On Tue, 6 Jun 2023 15:56:45 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableRowSkin.java
>>  line 117:
>> 
>>> 115:         TreeTableView<T> treeTableView = 
>>> getSkinnable().getTreeTableView();
>>> 116:         if (treeTableView == null) {
>>> 117:             
>>> registerInvalidationListener(getSkinnable().treeTableViewProperty(), (x) -> 
>>> {
>> 
>> One question here: Why does this prevent the leak but the ListenerHelper 
>> does not?
>
> The difference is that registerInvalidationListener() adds a weak listener, 
> while ListenerHelper adds a strong listener.
> 
> It is possible to use ListenerHelper here, at the expense of more complicated 
> code since we'd need to explicitly disconnect the listener when 
> tableViewProperty value gets set.  
> 
> Another solution would involve adding a method to add a weak listener to the 
> ListenerHelper to avoid explicit cleanup, or
> 
> Go back to the original code which used register/unregister*Listener **in 
> this particular case**.

Okay, makes sense.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1129#discussion_r1220038627

Reply via email to