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

Dmitri Trembovetski Dmitri.Trembovetski at Sun.COM
Wed Sep 10 23:54:02 UTC 2008

   Yep, I see. I didn't look at the file itself, only at the
   patch, and got confused.


Roman Kennke wrote:
> 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

More information about the 2d-dev mailing list