Skip to content

Commit 5a62e99

Browse files
author
Andrey Turbanov
committed
8357686: Remove unnecessary Map.get from AWTAutoShutdown.unregisterPeer
Reviewed-by: serb, aivanov
1 parent 982064e commit 5a62e99

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -358,8 +358,7 @@ void registerPeer(final Object target, final Object peer) {
358358
void unregisterPeer(final Object target, final Object peer) {
359359
synchronized (activationLock) {
360360
synchronized (mainLock) {
361-
if (peerMap.get(target) == peer) {
362-
peerMap.remove(target);
361+
if (peerMap.remove(target, peer)) {
363362
notifyPeerMapUpdated();
364363
}
365364
}

0 commit comments

Comments
 (0)