On Tue, 3 Feb 2026 19:58:58 GMT, Sergey Bylokhov <[email protected]> wrote:
>> Remove AppContext from java/awt/SystemTray
>
> src/java.desktop/share/classes/java/awt/SystemTray.java line 317:
>
>> 315: */
>> 316: public TrayIcon[] getTrayIcons() {
>> 317: if (icons != null) {
>
> This looks like a synchronization bug. Previously, it seemed to be synced via
> the app context.
I noticed that this isn't synchronized whilst other cases are, and it may be a
bug but I really hope it wasn't designed to rely on AppContext internals for
synchronization !
I can add a synchronized block but the worst that can happen without it is that
it sees null and returns an empty array of TrayIcon instead of one with some
concurrently added icon, and that could happen anyway depending on which thread
entered first.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29531#discussion_r2761083054