New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: crash on printer dialog cancellation #32632
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! 🙇♀️
Another question, the scripted print sequences will be triggered for renderer initiated print calls like the pdf viewer print and |
@deepak1556 updated and tested with https://gist.github.com/0f0e776b138452d6815ef4efc16aa0d1 to confirm that this fix covers relevant scenarios. |
Release Notes Persisted
|
I was unable to backport this PR to "17-x-y" cleanly; |
When can we expect a backport of this (to 17)? |
@codebytere has manually backported this PR to "17-x-y", please check out #33015 |
Description of Change
Closes #32684.
This PR fixes a crash that occurred when a user attempted to print a document either with
window.print()
, the print button in the PDF viewer, or withBrowserWindow.webContents()
and clicked cancel in the resulting print dialog. This was introduced in e693ad9 as a result of an attempt to handle upstream changed in CL:3305095. This added a new functionOnUserInitCancelled
to thePrintJob
Observer
with the intent that when a job was cancelled it would broadcast to an observed functionOnUserInitCancelled()
inPrintViewManagerBase
. However, there is one critical problem with that - thatprint_job_
does not exist that that point and is intialized afterwards here. As such,print_job->OnUserInitCancelled()
was a null pointer crash. We fix this by moving the cancellation check toScriptedPrintReplyOnIO
.Checklist
npm test
passesRelease Notes
Notes: Fixed a crash that occurred when a user attempted to print a document either with
window.print()
, the print button in the PDF viewer, or withBrowserWindow.webContents()
and clicked cancel in the resulting print dialog