On Thu, 1 Dec 2022 10:12:26 GMT, eduardsdv <d...@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 three additional 
> commits since the last revision:
> 
>  - Revert "8295324: Apply patch with junit from the issue"
>    
>    This reverts commit c76b8207242a7af82f5515e49760158fa40da2a9.
>  - Revert "8295324: Fix race condition in junit test"
>    
>    This reverts commit fdec73d8f4ff21908bf99d191b76ffeed42bfb36.
>  - Revert "8295324: Adjust the J2DPrinterJobTest"
>    
>    This reverts commit 0723d2ebcd2c41d40005dbb1652c4ec96cfe4f8c.

Marked as reviewed by prr (Reviewer).

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

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

Reply via email to