[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] RFR: 8054991 : sun.font.GlyphList uses broken double-checked locking
From:       Alexey Ivanov <alexey.ivanov () oracle ! com>
Date:       2016-05-26 12:23:16
Message-ID: 8477f52c-854c-480d-aa11-1ac7acfc0b1e () oracle ! com
[Download RAW message or body]

Hi Phil,

Since reusableGL is written only once, I'm for marking the field final.

The proposed patch is attached to JBS bug under the name 'pp'.

Marking inUse field as volatile seems enough to fix the issue. However 
the suggested patch makes code cleaner.


Regards,
Alexey

On 26.05.2016 1:18, Phil Race wrote:
> bug : https://bugs.openjdk.java.net/browse/JDK-8054991
>
> There is a comment in there about a proposed patch but I can't find it.
> However I think this will be sufficient :-
>
> diff --git a/src/java.desktop/share/classes/sun/font/GlyphList.java 
> b/src/java.desktop/share/classes/sun/font/GlyphList.java
> --- a/src/java.desktop/share/classes/sun/font/GlyphList.java
> +++ b/src/java.desktop/share/classes/sun/font/GlyphList.java
> @@ -152,7 +152,7 @@
>       * created.
>       */
>      private static GlyphList reusableGL = new GlyphList();
> -    private static boolean inUse;
> +    private static volatile boolean inUse;
>
> -phil.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic