On Tue, 15 Jul 2025 21:14:54 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:

>> Remove a finalize() method in CGraphicsEnvironment, replacing it with 
>> Disposer.
>> 
>> I don't see a way to add a test to verify this clean up.
>
> src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java line 153:
> 
>> 151:         }
>> 152: 
>> 153:         public synchronized void dispose() {
> 
> Why the method is synchronized? we can call it on a different threads via 
> Disposer?

It doesn't have to be. Is it a problem that it is ?

> src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java line 154:
> 
>> 152: 
>> 153:         public synchronized void dispose() {
>> 154:             if (displayReconfigContext != 0L) {
> 
> can it be 0 here? it seems we never register 0 pointer, and we have a guard 
> in native to be safe.

and is there any harm in the check ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26332#discussion_r2208843438
PR Review Comment: https://git.openjdk.org/jdk/pull/26332#discussion_r2208843774

Reply via email to