RFR: 8295324: JavaFX: Blank pages when printing [v2]

eduardsdv duke at openjdk.org
Fri Oct 21 13:36:07 UTC 2022


On Mon, 17 Oct 2022 07:12:00 GMT, eduardsdv <duke at openjdk.org> wrote:

>> This fixes a race condition between application and 'Print Job Thread' threads when printing.
>> 
>> The race condition occurs when application thread calls `endJob()`, which in effect sets the `jobDone` flag to true,
>> and when the 'Print Job Thread' thread was in the `synchronized` block in `waitForNextPage()` at that time.
>> The 'Print Job Thread' thread checks `jobDone` flag after exiting the `synchronized` block and, if it is true, skips the last page.
>> 
>> In this fix, not only the `jobDone` is checked, but also that there is no other page to be printed.
>> It was also needed to introduce a new flag 'jobCanceled', to skip the page if the printing was canceled by 'cancelJob()'.
>
> eduardsdv has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8295324: Fix race condition in junit test

Please review

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

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


More information about the openjfx-dev mailing list