electron / electron

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

Home Page:https://electronjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Disabling BrowserWindow object causes crash on MacOS

Jodom988 opened this issue · comments

Preflight Checklist

Electron Version

Tested on versions 19.0.5, 18.3.4, 17.4.8 and 16.2.8

What operating system are you using?

macOS

Operating System Version

Monterey v12.3

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

Went all the way back to 12.2.3 and issue was still present.

Expected Behavior

When calling setEnabled(false) on a BrowserWindow object, I would expect the window to become disabled or some error to be thrown if it fails.

Actual Behavior

Behavior
Calling setEnabled(false) on a BrowserWindow object causes Electron to quit abruptly on MacOS. No stack trace is given in the terminal but a message is printed that reads:
<path to Electron.app>/Electron.app/Contents/MacOS/Electron exited with signal SIGTRAP

Using an Intel based Mac the error message was the same except it exited with SIGILL.
Surrounding the code in a try/catch block does not stop Electron from crashing.

Reproduce
Add the following line to the quickstart repo in index.js on line 17:
mainWindow.setEnabled(false);

To slightly delay so Electron/OS has time to show a window before crashing, use this instead:
setTimeout(() => { mainWindow.setEnabled(false); }, 1000);

Testcase Gist URL

No response

Additional Information

No response