On Wed, 8 Sep 2021 07:52:31 GMT, Florian Kirmaier <[email protected]> wrote:

>> This PR switches the Thread to the QuantumRenderer, in the case the Disposer 
>> is called from another Thread - the printing Thread.
>> I'm open for better solutions on how to fix this Issue.
>> Initially i thought there is also a Race Condition in the resource pool, but 
>> a new one is created for the Printing Thread.
>
> Florian Kirmaier has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   JDK-8271395
>   QuantumRenderer is no longer public

modules/javafx.graphics/src/main/java/com/sun/prism/impl/Disposer.java line 131:

> 129:      */
> 130:     public static void cleanUp() {
> 131:         if 
> (!Thread.currentThread().getName().startsWith("QuantumRenderer")) {

This seemed like a dubious way to detect the render thread so I looked around 
for how it is done elsewhere but instead I found
com/sun/javafx/sg/prism/NGCanvas.java
    private static void runOnRenderThread(final Runnable r) {
        // We really need a standard mechanism to detect the render thread !
        if (Thread.currentThread().getName().startsWith("QuantumRenderer")) {

And .. it is also used by printing, and I added it in 2013 :-(

In my defence I copied the code from webview as mentioned in 
https://bugs.openjdk.org/browse/JDK-8094524

oh well.

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

PR: https://git.openjdk.org/jfx/pull/618

Reply via email to