On Tue, 7 Jul 2026 19:41:40 GMT, Andy Goryachev <[email protected]> wrote:

> Fixes double check locking by adding the `volatile` keyword.
> 
> During normal operation, the access seems to happen from two threads:
> 
> Thread[#29,QuantumRenderer-0,5,main]
> Thread[#34,JavaFX Application Thread,5,main]
> 
> 
> On one hand, this access is likely to be mutually exclusive, on the other 
> hand, javafx does allow the nodes to be created in a background thread, and 
> it might be possible to invoke, for example, `GlyphLayout.breakRuns()` from a 
> background thread.
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

modules/javafx.graphics/src/main/java/com/sun/javafx/font/PrismFontFile.java 
line 1439:

> 1437:    }
> 1438: 
> 1439:    private volatile ColorGlyphStrike[] sbixStrikes;

I don't have time to look at this for jfx27, so I recommend leaving it for 
after the fork, but I see at one other related threading issue. Both should be 
fixed at the same time (else there is little point in changing anything). The 
`buildSbixStrikeTables()` could be called twice, since it isn't inside the 
inner `if (sbixStrikes == null)`. It won't be called concurrently, but will 
still do the initialization more than once which is, at best, unnecessary.

Minor: I prefer to leave the `= null` that you removed, since code is checking 
/ relying on the initial value (yes I know it doesn't actually matter, but I 
find it more self-documenting with the explicit initialization).

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2205#discussion_r3539984764

Reply via email to