diff options
author | Paul Beusterien <paulbeusterien@google.com> | 2018-06-25 10:48:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-25 10:48:09 -0700 |
commit | 19e0c0bb6ab4e3fdbc72acf9bd967e1ffaa3866d (patch) | |
tree | 4e893e83133cbb0b0c8540f86ea0fb4a9597b6a4 /Firebase/Auth | |
parent | 47ab39aee6330f59263b0a9b2fc36536544651fd (diff) |
Fix data race issue caught by sanitizer (#1446)
Diffstat (limited to 'Firebase/Auth')
-rw-r--r-- | Firebase/Auth/Source/FIRAuthAppDelegateProxy.m | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Firebase/Auth/Source/FIRAuthAppDelegateProxy.m b/Firebase/Auth/Source/FIRAuthAppDelegateProxy.m index 3289b4e..73fbfda 100644 --- a/Firebase/Auth/Source/FIRAuthAppDelegateProxy.m +++ b/Firebase/Auth/Source/FIRAuthAppDelegateProxy.m @@ -205,14 +205,14 @@ static BOOL isIOS9orLater() { // iOS App extensions should not call [UIApplication sharedApplication], even if UIApplication // responds to it. static Class applicationClass = nil; - if (![FIRAppEnvironmentUtil isAppExtension]) { - Class cls = NSClassFromString(@"UIApplication"); - if (cls && [cls respondsToSelector:NSSelectorFromString(@"sharedApplication")]) { - applicationClass = cls; - } - } - UIApplication *application = [applicationClass sharedApplication]; dispatch_once(&onceToken, ^{ + if (![FIRAppEnvironmentUtil isAppExtension]) { + Class cls = NSClassFromString(@"UIApplication"); + if (cls && [cls respondsToSelector:NSSelectorFromString(@"sharedApplication")]) { + applicationClass = cls; + } + } + UIApplication *application = [applicationClass sharedApplication]; sharedInstance = [[self alloc] initWithApplication:application]; }); return sharedInstance; |