On Wed, 14 May 2025 18:52:55 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:

>> Instead of separate `.get`+`.remove` calls we can call `.remove` and then 
>> compare result with `null`
>
> src/java.desktop/share/classes/java/awt/Toolkit.java line 1745:
> 
>> 1743:         synchronized (this) {
>> 1744:             SelectiveAWTEventListener selectiveListener =
>> 1745:                 listener2SelectiveListener.remove(localL);
> 
> While analyzing the implementation of this method, I noticed a potential bug 
> at the beginning. Should it instead be:
> 
> if (localL == null) {
>     return;
> }
> 
> ?

Looks like yes. I think it's worth to create a separate issue to fix it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24692#discussion_r2095112071

Reply via email to