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

Plat 9367 thermal state workaround #1514

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Bugsnag/Helpers/BSGRunContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,16 @@ static void NoteThermalState(__unused CFNotificationCenterRef center,
__unused CFNotificationName name,
const void *object,
__unused CFDictionaryRef userInfo) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
bsg_runContext->thermalState = ((__bridge NSProcessInfo *)object).thermalState;
#pragma clang diagnostic pop
BSGRunContextUpdateTimestamp();
if (@available(iOS 11.0, tvOS 11.0, watchOS 4.0, *)) {
// Workaround for iOS 15.0.2 to 15.1.1: Foundation in rare cases posts
// ThermalStateDidChangeNotification from within -[NSProcessInfo thermalState],
// causing recursion and a crash via _os_unfair_lock_recursive_abort().
// To avoid this, grab the new thermal state asynchronously.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
bsg_runContext->thermalState = ((__bridge NSProcessInfo *)object).thermalState;
BSGRunContextUpdateTimestamp();
});
}
}

#if BSG_HAVE_OOM_DETECTION
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

## TBD

### Bug fixes

* Workaround for thermal state lock re-entry bug on iOS 15.0.2-15.1.1.
[1514]https://github.com/bugsnag/bugsnag-cocoa/pull/1514

* Clean up compiler warnings about data races and nullability.
[1515](https://github.com/bugsnag/bugsnag-cocoa/pull/1515)

## 6.25.1 (2022-12-07)

### Bug fixes
Expand Down