On Tue, 29 Jun 2021 12:36:50 GMT, Jeanette Winzenburg <faste...@openjdk.org> 
wrote:

>> we are a bit inconsistent in wrapping (or not) listeners into their weak 
>> counterparts - behaviors tend to not :) That's okay - and less crowded by 
>> additional code - as long as they are removed properly, IMO. But just 
>> seeing: good question, as the focusOwner listener is wrapped, need to 
>> consult my notes. Thanks for the heads up!
>> 
>>  As to the single vs. multiple lines: ersonally, I tend to not change more 
>> than absolutely needed - it had the brackets before the fix so I kept them.
>
> Okay, went through listener registrations in all behaviors - and they are 
> indeed inconsistent: 
> 
> - some listen to control properties like focused (f.i. Button, Combo): adding 
> strong, often inline listeners
> - some listen to control path properties like selection/Model/Indices (f.i. 
> ListView, TreeView): adding weak (inline or field) wrappers 
> - cleanup for all guarantees to make those listeners removable (without 
> touching their type) and actually remove them in dispose
> 
> So I tend to follow that approach here as well, opinions?

I'm also interested in the opinion from others. I think we are a bit more safer 
with weak listener and there are used often as well. 
But as you correctly mentioned a lot of times (still) a listener is created 
inline. But I think on most occurences where it is not it is wrapped in an weak 
one.

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

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

Reply via email to