[OpenJDK 2D-Dev] [PATCH] SwingUtilities2.isLocalDisplay()

Roman Kennke roman at kennke.org
Wed Sep 10 23:45:08 UTC 2008

Hi Dmitri,

> > I need to repost my original patch for two reasons: 1. it doesn't apply
> > cleanly (only with some fuzz), 2. it also has this init-loop problem.
> > Find attached the correct version. I'd be happy to see it committed
> > ASAP.
>    I have a question about the fix:
> --- a/src/solaris/native/sun/awt/fontpath.c	Thu Aug 07 09:42:31 2008 -0700
> +++ b/src/solaris/native/sun/awt/fontpath.c	Wed Sep 10 23:52:15 2008 +0200
> @@ -156,7 +156,7 @@
>       isLocal = JNU_CallStaticMethodByName(env, NULL,
>                                            "sun/awt/X11GraphicsEnvironment",
> -                                         "isDisplayLocal",
> +                                         "_isDisplayLocal",
>                                            "()Z").z;
>    Didn't you change isDisplayLocal to be non-static
>    in X11GraphicsEnvironment? If so how does this actually
>    work since you still call CallStaticMethodByName?

The _isDisplayLocal() is a static method in X11GraphicsEnvironment,
which is called by isDisplayLocal() after entering the AWT monitor. The
above code is already executed inside the AWT lock, so this is not a
problem. And it is only called from the X11 backend anyway. Calling
isDisplayLocal() results in a loop though, because it tries to load the
X11GraphicsEnvironment class, which in turn causes the class initializer
of SGE to be executed, which calls back into the code above, ad
infinitum. This is why we call the static _isDisplayLocal() instead. The
real solution would be to rework all the SGE and FontManager code, which
we did, but send in a separate patch. :-) (You can also take a peek at
this code in our repository
(http://hg.openjdk.java.net/caciocavallo/jdk7/) ).

Thanks, Roman

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20080911/ec816682/signature.asc>

More information about the 2d-dev mailing list