-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix main thread crashing issue, reenable tests. #3974
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -37,6 +37,13 @@ BOOL GDTCORReachabilityFlagsContainWWAN(SCNetworkReachabilityFlags flags) { | |||
#endif // TARGET_OS_IOS | |||
} | |||
|
|||
@interface GDTCORApplication () { | |||
/** Private flag to match the existing `readonly` public flag. */ | |||
BOOL _isRunningInBackground; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't write it from different threads (only read), but it may make sense to add volatile
just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or declare it as an atomic property (which is a bit more common way to declare thread-safe variables)
[notifCenter postNotificationName:kGDTCORApplicationDidEnterBackgroundNotification object:nil]; | ||
[notifCenter postNotificationName:UIApplicationDidEnterBackgroundNotification object:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change from the abstracted notification to an iOS-specific one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We previously used the abstract one because it triggered each classes' foreground/background
flags, but now since the flag moved it's set before the abstracted notification is fired. Meaning: the abstract notification no longer triggers the flag to change, only the iOS specific one does.
* Fix main thread crashing issue, reenable tests. * Added log, extra check for event generation to prevent early exit. * Temporarily run cron tests for travis. * Revert travis.yml update * Change property to atomic based on review comments.
Checking
applicationState
while not on the main thread results in a crash. Revert to using notifications and a flag to track this, but with a single source of truth.Fixes #3973.