On Mon, 5 Aug 2024 10:09:06 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> When a printjob is cancelled midway, `PrinterAbortException `was not thrown 
>> in macos. because 
>> firstly,` cancelCheck` invokes` LWCToolkit.invokeLater` with null as 
>> parameter causing it to fail with NPE and
>> secondly PrinterAbortException was consumed silently when `printLoop` throws 
>> any exception
>> which is rectified to throw the PrinterAbortException when encountered..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Dont call completePrintLoop if cancelDoc is called as both exits 
> PrintingLoop

I modified the PR to implement this
(1) grab the exception
(2) clear it from the current thread, but we still have a ref - it is just a 
Java object !
(3) store it in some field of the CPrinterJob
(4) then check for it and re-throw when we reach Java code.

which solves the (3) NSException log  
but (2) macos error popup is still there.. I guess it is because it prints 1st 
page but there is a blank 2nd page which seems to suggest macos printer driver 
spooled the page but failed to print as it was aborted so it threw the error 
popup..

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

PR Comment: https://git.openjdk.org/jdk/pull/20027#issuecomment-2272592973

Reply via email to