On Tue, 15 Jul 2025 22:38:07 GMT, Phil Race <p...@openjdk.org> wrote:
>> src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java line 138: >> >>> 136: } >>> 137: cfDictionaryPtr = 0; >>> 138: } >> >> Is it possible for this method to be called twice? It seems that not all >> other implementations include the ptr != 0 guard. >> >> Also, synchronization appears to be used on the wrong object. I believe it >> should be synchronized on the outer JRSUIControl class, which uses >> synchronization to access the cfDictionaryPtr field. Alternatively, we might >> consider implementing synchronization in a different way. > > I am not *expecting* it to be called twice. I'm just saying that with this > check it would be safe if it were. > Not sure I even need synchronization here. Only the Disposer will have a > reference. > So I could remove synchronized, remove the != 0 check ... but I don't see a > problem either way. That would be great if we could drop all unneeded code. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26331#discussion_r2208934516