{"action":"created","comment":{"url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/comments/102563258","pull_request_review_id":23322876,"id":102563258,"diff_hunk":"@@ -932,39 +931,43 @@ - (void)resetWebUserAgent\n \n - (void)startRefreshFlowConnectionTimer\n {\n-    self.refreshTimerThread = [NSThread currentThread];\n+    if (![NSThread isMainThread]) {\n+        __weak typeof(self) weakSelf = self;\n+        dispatch_async(dispatch_get_main_queue(), ^{\n+            [weakSelf startRefreshFlowConnectionTimer];\n+        });\n+        return;\n+    }\n+\n     self.refreshFlowConnectionTimer = [NSTimer scheduledTimerWithTimeInterval:self.timeout\n-                                                                       target:self\n-                                                                     selector:@selector(refreshFlowConnectionTimerFired:)\n-                                                                     userInfo:nil\n-                                                                      repeats:NO];\n+                                                                           target:self\n+                                                                         selector:@selector(refreshFlowConnectionTimerFired:)\n+                                                                         userInfo:nil\n+                                                                          repeats:NO];\n }\n \n - (void)stopRefreshFlowConnectionTimer\n {\n-    if (self.refreshFlowConnectionTimer != nil && self.refreshTimerThread != nil) {\n-        [self performSelector:@selector(invalidateRefreshTimer) onThread:self.refreshTimerThread withObject:nil waitUntilDone:YES];\n-        [self cleanupRefreshTimer];\n+    if (![NSThread isMainThread]) {\n+        __weak typeof(self) weakSelf = self;","path":"libs/SalesforceSDKCore/SalesforceSDKCore/Classes/OAuth/SFOAuthCoordinator.m","position":38,"original_position":38,"commit_id":"a5c4f63900e55d381fda1bc852af99ab9fbc7629","original_commit_id":"a5c4f63900e55d381fda1bc852af99ab9fbc7629","user":{"login":"khawkins","id":755462,"avatar_url":"https://avatars.githubusercontent.com/u/755462?v=3","gravatar_id":"","url":"https://api.github.com/users/khawkins","html_url":"https://github.com/khawkins","followers_url":"https://api.github.com/users/khawkins/followers","following_url":"https://api.github.com/users/khawkins/following{/other_user}","gists_url":"https://api.github.com/users/khawkins/gists{/gist_id}","starred_url":"https://api.github.com/users/khawkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khawkins/subscriptions","organizations_url":"https://api.github.com/users/khawkins/orgs","repos_url":"https://api.github.com/users/khawkins/repos","events_url":"https://api.github.com/users/khawkins/events{/privacy}","received_events_url":"https://api.github.com/users/khawkins/received_events","type":"User","site_admin":false},"body":"Same here.","created_at":"2017-02-22T20:22:36Z","updated_at":"2017-02-22T20:23:19Z","html_url":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/1933#discussion_r102563258","pull_request_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/1933","_links":{"self":{"href":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/comments/102563258"},"html":{"href":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/1933#discussion_r102563258"},"pull_request":{"href":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/1933"}}},"pull_request":{"url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/1933","id":107488572,"html_url":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/1933","diff_url":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/1933.diff","patch_url":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/1933.patch","issue_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/1933","number":1933,"state":"open","locked":false,"title":"Fix NSTimer Race Condition","user":{"login":"sgoldberg-sfdc","id":15946360,"avatar_url":"https://avatars.githubusercontent.com/u/15946360?v=3","gravatar_id":"","url":"https://api.github.com/users/sgoldberg-sfdc","html_url":"https://github.com/sgoldberg-sfdc","followers_url":"https://api.github.com/users/sgoldberg-sfdc/followers","following_url":"https://api.github.com/users/sgoldberg-sfdc/following{/other_user}","gists_url":"https://api.github.com/users/sgoldberg-sfdc/gists{/gist_id}","starred_url":"https://api.github.com/users/sgoldberg-sfdc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgoldberg-sfdc/subscriptions","organizations_url":"https://api.github.com/users/sgoldberg-sfdc/orgs","repos_url":"https://api.github.com/users/sgoldberg-sfdc/repos","events_url":"https://api.github.com/users/sgoldberg-sfdc/events{/privacy}","received_events_url":"https://api.github.com/users/sgoldberg-sfdc/received_events","type":"User","site_admin":false},"body":"- Original code was developed to ensure thread is stopped on same thread it is created on\r\n- This can also be accomplished by ensuring it is always run on the main thread (which in practice it most often was)\r\n- If the timer had been created on a background thread this could result in a race condition between the performselector call and the thread terminating.","created_at":"2017-02-22T20:13:21Z","updated_at":"2017-02-22T20:23:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"809f6ac04d5c60d89d3a573732b2758559551053","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/1933/commits","review_comments_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/1933/comments","review_comment_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/1933/comments","statuses_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/statuses/a5c4f63900e55d381fda1bc852af99ab9fbc7629","head":{"label":"sgoldberg-sfdc:dev-nstimer-race_condition","ref":"dev-nstimer-race_condition","sha":"a5c4f63900e55d381fda1bc852af99ab9fbc7629","user":{"login":"sgoldberg-sfdc","id":15946360,"avatar_url":"https://avatars.githubusercontent.com/u/15946360?v=3","gravatar_id":"","url":"https://api.github.com/users/sgoldberg-sfdc","html_url":"https://github.com/sgoldberg-sfdc","followers_url":"https://api.github.com/users/sgoldberg-sfdc/followers","following_url":"https://api.github.com/users/sgoldberg-sfdc/following{/other_user}","gists_url":"https://api.github.com/users/sgoldberg-sfdc/gists{/gist_id}","starred_url":"https://api.github.com/users/sgoldberg-sfdc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgoldberg-sfdc/subscriptions","organizations_url":"https://api.github.com/users/sgoldberg-sfdc/orgs","repos_url":"https://api.github.com/users/sgoldberg-sfdc/repos","events_url":"https://api.github.com/users/sgoldberg-sfdc/events{/privacy}","received_events_url":"https://api.github.com/users/sgoldberg-sfdc/received_events","type":"User","site_admin":false},"repo":{"id":80163313,"name":"SalesforceMobileSDK-iOS","full_name":"sgoldberg-sfdc/SalesforceMobileSDK-iOS","owner":{"login":"sgoldberg-sfdc","id":15946360,"avatar_url":"https://avatars.githubusercontent.com/u/15946360?v=3","gravatar_id":"","url":"https://api.github.com/users/sgoldberg-sfdc","html_url":"https://github.com/sgoldberg-sfdc","followers_url":"https://api.github.com/users/sgoldberg-sfdc/followers","following_url":"https://api.github.com/users/sgoldberg-sfdc/following{/other_user}","gists_url":"https://api.github.com/users/sgoldberg-sfdc/gists{/gist_id}","starred_url":"https://api.github.com/users/sgoldberg-sfdc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgoldberg-sfdc/subscriptions","organizations_url":"https://api.github.com/users/sgoldberg-sfdc/orgs","repos_url":"https://api.github.com/users/sgoldberg-sfdc/repos","events_url":"https://api.github.com/users/sgoldberg-sfdc/events{/privacy}","received_events_url":"https://api.github.com/users/sgoldberg-sfdc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sgoldberg-sfdc/SalesforceMobileSDK-iOS","description":"Force.com mobile SDK for iOS applications","fork":true,"url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS","forks_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/forks","keys_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/teams","hooks_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/hooks","issue_events_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/events","assignees_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/tags","blobs_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/languages","stargazers_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/stargazers","contributors_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/contributors","subscribers_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/subscribers","subscription_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/subscription","commits_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/merges","archive_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/downloads","issues_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/labels{/name}","releases_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/releases{/id}","deployments_url":"https://api.github.com/repos/sgoldberg-sfdc/SalesforceMobileSDK-iOS/deployments","created_at":"2017-01-26T22:49:14Z","updated_at":"2017-01-26T22:49:19Z","pushed_at":"2017-02-22T20:12:40Z","git_url":"git://github.com/sgoldberg-sfdc/SalesforceMobileSDK-iOS.git","ssh_url":"git@github.com:sgoldberg-sfdc/SalesforceMobileSDK-iOS.git","clone_url":"https://github.com/sgoldberg-sfdc/SalesforceMobileSDK-iOS.git","svn_url":"https://github.com/sgoldberg-sfdc/SalesforceMobileSDK-iOS","homepage":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS","size":347210,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"forcedotcom:dev","ref":"dev","sha":"0d0c5d855c76661bad8acf6e2963559170094ca6","user":{"login":"forcedotcom","id":464563,"avatar_url":"https://avatars.githubusercontent.com/u/464563?v=3","gravatar_id":"","url":"https://api.github.com/users/forcedotcom","html_url":"https://github.com/forcedotcom","followers_url":"https://api.github.com/users/forcedotcom/followers","following_url":"https://api.github.com/users/forcedotcom/following{/other_user}","gists_url":"https://api.github.com/users/forcedotcom/gists{/gist_id}","starred_url":"https://api.github.com/users/forcedotcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forcedotcom/subscriptions","organizations_url":"https://api.github.com/users/forcedotcom/orgs","repos_url":"https://api.github.com/users/forcedotcom/repos","events_url":"https://api.github.com/users/forcedotcom/events{/privacy}","received_events_url":"https://api.github.com/users/forcedotcom/received_events","type":"Organization","site_admin":false},"repo":{"id":2338086,"name":"SalesforceMobileSDK-iOS","full_name":"forcedotcom/SalesforceMobileSDK-iOS","owner":{"login":"forcedotcom","id":464563,"avatar_url":"https://avatars.githubusercontent.com/u/464563?v=3","gravatar_id":"","url":"https://api.github.com/users/forcedotcom","html_url":"https://github.com/forcedotcom","followers_url":"https://api.github.com/users/forcedotcom/followers","following_url":"https://api.github.com/users/forcedotcom/following{/other_user}","gists_url":"https://api.github.com/users/forcedotcom/gists{/gist_id}","starred_url":"https://api.github.com/users/forcedotcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forcedotcom/subscriptions","organizations_url":"https://api.github.com/users/forcedotcom/orgs","repos_url":"https://api.github.com/users/forcedotcom/repos","events_url":"https://api.github.com/users/forcedotcom/events{/privacy}","received_events_url":"https://api.github.com/users/forcedotcom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS","description":"Force.com mobile SDK for iOS applications","fork":false,"url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS","forks_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/forks","keys_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/teams","hooks_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/hooks","issue_events_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/events","assignees_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/tags","blobs_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/languages","stargazers_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/stargazers","contributors_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/contributors","subscribers_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/subscribers","subscription_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/subscription","commits_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/merges","archive_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/downloads","issues_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/labels{/name}","releases_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/releases{/id}","deployments_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/deployments","created_at":"2011-09-06T23:13:57Z","updated_at":"2017-02-17T16:57:17Z","pushed_at":"2017-02-22T20:13:22Z","git_url":"git://github.com/forcedotcom/SalesforceMobileSDK-iOS.git","ssh_url":"git@github.com:forcedotcom/SalesforceMobileSDK-iOS.git","clone_url":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS.git","svn_url":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS","homepage":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS","size":347241,"stargazers_count":356,"watchers_count":356,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":269,"mirror_url":null,"open_issues_count":14,"forks":269,"open_issues":14,"watchers":356,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/1933"},"html":{"href":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/1933"},"issue":{"href":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/1933"},"comments":{"href":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/1933/comments"},"review_comments":{"href":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/1933/comments"},"review_comment":{"href":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/pulls/1933/commits"},"statuses":{"href":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/statuses/a5c4f63900e55d381fda1bc852af99ab9fbc7629"}}}}
{"actor":{"display_login":"khawkins"}}