-
Notifications
You must be signed in to change notification settings - Fork 276
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 in Mac extensions #1466
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #1466 +/- ##
=======================================
Coverage 25.10% 25.10%
=======================================
Files 206 206
Lines 16948 16948
=======================================
Hits 4254 4254
Misses 12694 12694 Continue to review full report at Codecov.
|
zacwest
added a commit
that referenced
this pull request
Feb 6, 2021
## Summary Accessing the NSStatusBar in an extension causes a crash; this avoids calling it in extensions. We also should not be touching the status bar in an extension either way. ## Any other notes Didn't show up during the betas, nor does it show up in Sentry. I'm guessing it's crashing so early in the MacBridge code that it doesn't have an opportunity to deal with crash logs. Crashes look like: ``` Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Application Specific Information: Assertion failed: (CGAtomicGet(&is_initialized)), function CGSConnectionByID, file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/SkyLight/SkyLight-570.7/SkyLight/Services/Connection/CGSConnection.mm, line 133. Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff20504462 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff20532610 pthread_kill + 263 2 libsystem_c.dylib 0x00007fff20485720 abort + 120 3 libsystem_c.dylib 0x00007fff204849d6 __assert_rtn + 314 4 com.apple.SkyLight 0x00007fff24dad771 CGSConnectionByID + 423 5 com.apple.SkyLight 0x00007fff24f9f58a SLSRegisterConnectionNotifyProc + 31 6 com.apple.AppKit 0x00007fff236a476c +[NSCGSStatusItem addNavigationChangedNotificationHandler:] + 121 7 com.apple.AppKit 0x00007fff230fe170 -[NSStatusBar init] + 202 8 com.apple.Foundation 0x00007fff2136104c _NSFaultInObject + 27 9 io.robbie.HomeAssistant.dev.MacBridge 0x0000000107090389 MacBridgeStatusItem.init() + 105 (MacBridgeStatusItem.swift:4) 10 io.robbie.HomeAssistant.dev.MacBridge 0x0000000107090973 @objc MacBridgeStatusItem.init() + 19 11 io.robbie.HomeAssistant.dev.MacBridge 0x000000010709031b MacBridgeStatusItem.__allocating_init() + 27 12 io.robbie.HomeAssistant.dev.MacBridge 0x000000010709a295 MacBridgeImpl.init() + 213 (MacBridgeImpl.swift:12) 13 io.robbie.HomeAssistant.dev.MacBridge 0x000000010709a383 @objc MacBridgeImpl.init() + 19 14 io.robbie.HomeAssistant.dev.Shared 0x00000001037be6d9 closure #1 in variable initialization expression of Environment.macBridge + 2073 (Environment.swift:141) 15 io.robbie.HomeAssistant.dev.Shared 0x00000001037b9ad6 Environment.init() + 2150 (Environment.swift:132) ```
zacwest
added a commit
that referenced
this pull request
Feb 6, 2021
## Summary Accessing the NSStatusBar in an extension causes a crash; this avoids calling it in extensions. We also should not be touching the status bar in an extension either way. ## Any other notes Didn't show up during the betas, nor does it show up in Sentry. I'm guessing it's crashing so early in the MacBridge code that it doesn't have an opportunity to deal with crash logs. Crashes look like: ``` Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Application Specific Information: Assertion failed: (CGAtomicGet(&is_initialized)), function CGSConnectionByID, file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/SkyLight/SkyLight-570.7/SkyLight/Services/Connection/CGSConnection.mm, line 133. Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff20504462 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff20532610 pthread_kill + 263 2 libsystem_c.dylib 0x00007fff20485720 abort + 120 3 libsystem_c.dylib 0x00007fff204849d6 __assert_rtn + 314 4 com.apple.SkyLight 0x00007fff24dad771 CGSConnectionByID + 423 5 com.apple.SkyLight 0x00007fff24f9f58a SLSRegisterConnectionNotifyProc + 31 6 com.apple.AppKit 0x00007fff236a476c +[NSCGSStatusItem addNavigationChangedNotificationHandler:] + 121 7 com.apple.AppKit 0x00007fff230fe170 -[NSStatusBar init] + 202 8 com.apple.Foundation 0x00007fff2136104c _NSFaultInObject + 27 9 io.robbie.HomeAssistant.dev.MacBridge 0x0000000107090389 MacBridgeStatusItem.init() + 105 (MacBridgeStatusItem.swift:4) 10 io.robbie.HomeAssistant.dev.MacBridge 0x0000000107090973 @objc MacBridgeStatusItem.init() + 19 11 io.robbie.HomeAssistant.dev.MacBridge 0x000000010709031b MacBridgeStatusItem.__allocating_init() + 27 12 io.robbie.HomeAssistant.dev.MacBridge 0x000000010709a295 MacBridgeImpl.init() + 213 (MacBridgeImpl.swift:12) 13 io.robbie.HomeAssistant.dev.MacBridge 0x000000010709a383 @objc MacBridgeImpl.init() + 19 14 io.robbie.HomeAssistant.dev.Shared 0x00000001037be6d9 closure #1 in variable initialization expression of Environment.macBridge + 2073 (Environment.swift:141) 15 io.robbie.HomeAssistant.dev.Shared 0x00000001037b9ad6 Environment.init() + 2150 (Environment.swift:132) ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Accessing the NSStatusBar in an extension causes a crash; this avoids calling it in extensions. We also should not be touching the status bar in an extension either way.
Any other notes
Didn't show up during the betas, nor does it show up in Sentry. I'm guessing it's crashing so early in the MacBridge code that it doesn't have an opportunity to deal with crash logs.
Crashes look like: