hg: macosx-port/macosx-port/jdk: MACOSX_PORT-36: Toolkit.getScreenInsets() returns empty insets

Mike Swingler swingler at apple.com
Thu Jul 28 07:54:34 PDT 2011


On Jul 28, 2011, at 6:39 AM, sergey.bylokhov at oracle.com wrote:

> Changeset: 4dc4b821b3e4
> Author:    serb
> Date:      2011-07-28 17:32 +0400
> URL:       http://hg.openjdk.java.net/macosx-port/macosx-port/jdk/rev/4dc4b821b3e4
> 
> MACOSX_PORT-36: Toolkit.getScreenInsets() returns empty insets
> 
> ! src/macosx/classes/sun/lwawt/macosx/CWrapper.java
> ! src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
> ! src/macosx/native/sun/awt/CWrapper.m

There is a problem with this change set: you did not CFRetain() the screen pointer before bubbling it up to Java, and you also need to CFRelease() it when you are done. Otherwise, you will crash if the screen geometry is changing while this code is running.

It may be worth wrapping the NSScreen in it's own Java subclass of CFRetainedResource that will handle these details for you. As is, the thread safety is correct.

Should I file a bug on this?

Mike Swingler
Java Engineering
Apple Inc.



More information about the macosx-port-dev mailing list