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 when calling setProgressBar on macOS #16374

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@zcbenz
Copy link
Contributor

zcbenz commented Jan 12, 2019

Description of Change

Depending on the version of macOS and macOS SDK, the system may install a default contentView for the dock, resulting in crashes like #14008.

This PR makes the code correctly check if a progress bar has been installed in dock.

I'm not sure the exact condition to trigger the crash, and it is weird that there isn't much people seeing it. But I'm seeing it on my machine, and I can verify this PR fixes it on my machine.

Checklist

Release Notes

Notes: Fix crash when calling setProgressBar on macOS

@zcbenz zcbenz requested a review from electron/reviewers as a code owner Jan 12, 2019

@zcbenz zcbenz removed the target/2-0-x label Jan 13, 2019

@codebytere codebytere changed the title Fix crash when calling setProgressBar on macOS fix: crash when calling setProgressBar on macOS Jan 15, 2019

bool first_time = !dock_tile.contentView ||
[[dock_tile.contentView subviews] count] == 0 ||
![[[dock_tile.contentView subviews] lastObject]
isKindOfClass:[NSProgressIndicator class]];

This comment has been minimized.

@nornagon

nornagon Jan 17, 2019

Contributor

Can we record this explicitly rather than using the state of the dock tile as an implicit state variable? e.g. has_installed_indicator_ or something? & perhaps store a reference to the NSProgressIndicator?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment