Skip to content
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

[Bug]: webContents.print() crashes with a non-null callback #32750

Closed
3 tasks done
mgalla10 opened this issue Feb 4, 2022 · 3 comments · Fixed by #32767
Closed
3 tasks done

[Bug]: webContents.print() crashes with a non-null callback #32750

mgalla10 opened this issue Feb 4, 2022 · 3 comments · Fixed by #32767
Assignees
Labels

Comments

@mgalla10
Copy link

mgalla10 commented Feb 4, 2022

Preflight Checklist

Electron Version

17.0.0

What operating system are you using?

Windows

Operating System Version

Windows 10 version 20H2

What arch are you using?

x64

Last Known Working Electron version

17.0.0-beta.2

Expected Behavior

Calling webContents.print({}, () => {}) will not crash, and will show the system print dialog.

Actual Behavior

The electron app crashes, even when the aforementioned print() call is encapsulated within a try-catch block.

Testcase Gist URL

https://gist.github.com/1ab968669f64a7707306e876ab2ff5bc

Additional Information

Looks pretty similar to #32276, though I'm not able to reproduce the crash in 16.0.5 as the author of that issue claims.

Calling the print() API and providing undefined or null as the callback parameter still shows the dialog, although canceling that print dialog will still result in a crash (as documented in #32684). It's also worth noting that when running in Electron Fiddle, both the print dialog cancellation crash and this new crash share the same error code (3221225477), so I'm wondering if they're related, and if the PR fixing the dialog cancellation crash (#32632) might fix this as well.

@pushkin-
Copy link

pushkin- commented Feb 4, 2022

I actually just came across this error code without any printing workflow (Electron 16):

Exit status 3221225477
at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
at EventEmitter.emit (events.js:315:20)
at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1048:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)

@acutus
Copy link

acutus commented Feb 6, 2022

I ran into this as well. Tested with Electron 17.0.0 both on Ubuntu 20.04.3 x64 and Mac OS Big Sur (11.5.2).

Same behavior, with a callback defined print crashes directly when trying to print. With a null callback print succeeds (using silent: true).

@codebytere
Copy link
Member

codebytere commented Feb 7, 2022

Crashing fixed in #32632

@codebytere codebytere self-assigned this Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants