RFR: 8362291: [macOS] Remove finalize method in CGraphicsEnvironment.java
    Phil Race 
    prr at openjdk.org
       
    Tue Jul 15 22:42:39 UTC 2025
    
    
  
On Tue, 15 Jul 2025 21:14:54 GMT, Sergey Bylokhov <serb at 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
    
    
More information about the client-libs-dev
mailing list