From 8ce9f3b24daa8cf1fd8ed9ea27d9e1716c22fb4a Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 15 Aug 2018 10:38:47 -0400 Subject: [PATCH] Fix nominal race in "is registered" state. --- SignalServiceKit/src/Account/TSAccountManager.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SignalServiceKit/src/Account/TSAccountManager.m b/SignalServiceKit/src/Account/TSAccountManager.m index 79569e738..d143f9c05 100644 --- a/SignalServiceKit/src/Account/TSAccountManager.m +++ b/SignalServiceKit/src/Account/TSAccountManager.m @@ -37,7 +37,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling @interface TSAccountManager () -@property (nonatomic, readonly) BOOL isRegistered; +@property (atomic, readonly) BOOL isRegistered; // This property is exposed publicly for testing purposes only. #ifndef DEBUG @@ -120,8 +120,8 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling // Cache this once it's true since it's called alot, involves a dbLookup, and once set - it doesn't change. _isRegistered = [self storedLocalNumber] != nil; } + return _isRegistered; } - return _isRegistered; } - (void)didRegister