Skip to content

Commit

Permalink
Fix initialization of dictionary
Browse files Browse the repository at this point in the history
- Actually initialize the dictionary that stores refresh handles on a user
- Fix issue where refresh handle lifetime could be prolonged unnecessarily, which masked the above issue
  • Loading branch information
austinzheng committed Feb 20, 2017
1 parent 5a89982 commit 477e014
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Realm/RLMSyncSessionRefreshHandle.mm
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ - (void)_timerFired:(__unused NSTimer *)timer {
kRLMSyncAppIDKey: [RLMSyncManager sharedManager].appID,
};

__weak RLMSyncSessionRefreshHandle *weakSelf = self;
RLMSyncCompletionBlock handler = ^(NSError *error, NSDictionary *json) {
[self _onRefreshCompletionWithError:error json:json];
[weakSelf _onRefreshCompletionWithError:error json:json];
};
[RLMNetworkClient postRequestToEndpoint:RLMServerEndpointAuth
server:user.authenticationServer
Expand Down
1 change: 1 addition & 0 deletions Realm/RLMSyncUser.mm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ + (RLMSyncUser *)currentUser {
- (instancetype)initWithAuthServer:(nullable NSURL *)authServer {
if (self = [super init]) {
self.authenticationServer = authServer;
self.refreshHandles = [NSMutableDictionary dictionary];
return self;
}
return nil;
Expand Down

0 comments on commit 477e014

Please sign in to comment.