{"action":"created","comment":{"url":"https://api.github.com/repos/rs/SDWebImage/pulls/comments/25370507","id":25370507,"diff_hunk":"@@ -135,7 +135,10 @@ - (void)setOperationClass:(Class)operationClass {\n                                                          progress:^(NSInteger receivedSize, NSInteger expectedSize) {\n                                                              SDWebImageDownloader *sself = wself;\n                                                              if (!sself) return;\n-                                                             NSArray *callbacksForURL = [sself callbacksForURL:url];\n+                                                             __block NSArray *callbacksForURL;\n+                                                             dispatch_sync(sself.barrierQueue, ^{\n+                                                                 callbacksForURL = sself.URLCallbacks[url];\n+                                                             });","path":"SDWebImage/SDWebImageDownloader.m","position":8,"original_position":8,"commit_id":"f8c7b9014c4e77bb3901469d254dfaa2c556cd9f","original_commit_id":"f8c7b9014c4e77bb3901469d254dfaa2c556cd9f","user":{"login":"timkoma","id":4168601,"avatar_url":"https://avatars.githubusercontent.com/u/4168601?v=3","gravatar_id":"","url":"https://api.github.com/users/timkoma","html_url":"https://github.com/timkoma","followers_url":"https://api.github.com/users/timkoma/followers","following_url":"https://api.github.com/users/timkoma/following{/other_user}","gists_url":"https://api.github.com/users/timkoma/gists{/gist_id}","starred_url":"https://api.github.com/users/timkoma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timkoma/subscriptions","organizations_url":"https://api.github.com/users/timkoma/orgs","repos_url":"https://api.github.com/users/timkoma/repos","events_url":"https://api.github.com/users/timkoma/events{/privacy}","received_events_url":"https://api.github.com/users/timkoma/received_events","type":"User","site_admin":false},"body":"Not sure if this is fixes the problem . Taking pointer to NSArray using barrier doesn't solve threading problem: another thread can still modify array of callbacks while loop at rows  142-145 is using it.\r\nCode:\r\ncallbacksForURL = [self.URLCallbacks[url] copy];\r\nshould help. ","created_at":"2015-02-25T19:30:49Z","updated_at":"2015-02-25T19:30:49Z","html_url":"https://github.com/rs/SDWebImage/pull/1046#discussion_r25370507","pull_request_url":"https://api.github.com/repos/rs/SDWebImage/pulls/1046","_links":{"self":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/comments/25370507"},"html":{"href":"https://github.com/rs/SDWebImage/pull/1046#discussion_r25370507"},"pull_request":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/1046"}}},"pull_request":{"url":"https://api.github.com/repos/rs/SDWebImage/pulls/1046","id":29920088,"html_url":"https://github.com/rs/SDWebImage/pull/1046","diff_url":"https://github.com/rs/SDWebImage/pull/1046.diff","patch_url":"https://github.com/rs/SDWebImage/pull/1046.patch","issue_url":"https://api.github.com/repos/rs/SDWebImage/issues/1046","number":1046,"state":"closed","locked":false,"title":"fix SDWebImageDownloader threading issue","user":{"login":"hoppenichu","id":2619092,"avatar_url":"https://avatars.githubusercontent.com/u/2619092?v=3","gravatar_id":"","url":"https://api.github.com/users/hoppenichu","html_url":"https://github.com/hoppenichu","followers_url":"https://api.github.com/users/hoppenichu/followers","following_url":"https://api.github.com/users/hoppenichu/following{/other_user}","gists_url":"https://api.github.com/users/hoppenichu/gists{/gist_id}","starred_url":"https://api.github.com/users/hoppenichu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoppenichu/subscriptions","organizations_url":"https://api.github.com/users/hoppenichu/orgs","repos_url":"https://api.github.com/users/hoppenichu/repos","events_url":"https://api.github.com/users/hoppenichu/events{/privacy}","received_events_url":"https://api.github.com/users/hoppenichu/received_events","type":"User","site_admin":false},"body":"Sometimes, the completion handlers were not executed. (Maybe, related to #1032)","created_at":"2015-02-24T17:54:56Z","updated_at":"2015-02-25T19:30:49Z","closed_at":"2015-02-25T05:53:57Z","merged_at":"2015-02-25T05:53:57Z","merge_commit_sha":"b844037de2d216dd44f78347f88cd8ff72c9de52","assignee":null,"milestone":{"url":"https://api.github.com/repos/rs/SDWebImage/milestones/3","html_url":"https://github.com/rs/SDWebImage/milestones/4.0.0","labels_url":"https://api.github.com/repos/rs/SDWebImage/milestones/3/labels","id":696126,"number":3,"title":"4.0.0","description":"","creator":{"login":"bpoplauschi","id":154913,"avatar_url":"https://avatars.githubusercontent.com/u/154913?v=3","gravatar_id":"","url":"https://api.github.com/users/bpoplauschi","html_url":"https://github.com/bpoplauschi","followers_url":"https://api.github.com/users/bpoplauschi/followers","following_url":"https://api.github.com/users/bpoplauschi/following{/other_user}","gists_url":"https://api.github.com/users/bpoplauschi/gists{/gist_id}","starred_url":"https://api.github.com/users/bpoplauschi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpoplauschi/subscriptions","organizations_url":"https://api.github.com/users/bpoplauschi/orgs","repos_url":"https://api.github.com/users/bpoplauschi/repos","events_url":"https://api.github.com/users/bpoplauschi/events{/privacy}","received_events_url":"https://api.github.com/users/bpoplauschi/received_events","type":"User","site_admin":false},"open_issues":52,"closed_issues":29,"state":"open","created_at":"2014-06-19T19:21:07Z","updated_at":"2015-02-25T09:13:42Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/rs/SDWebImage/pulls/1046/commits","review_comments_url":"https://api.github.com/repos/rs/SDWebImage/pulls/1046/comments","review_comment_url":"https://api.github.com/repos/rs/SDWebImage/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rs/SDWebImage/issues/1046/comments","statuses_url":"https://api.github.com/repos/rs/SDWebImage/statuses/f8c7b9014c4e77bb3901469d254dfaa2c556cd9f","head":{"label":"hoppenichu:fix_downloader","ref":"fix_downloader","sha":"f8c7b9014c4e77bb3901469d254dfaa2c556cd9f","user":{"login":"hoppenichu","id":2619092,"avatar_url":"https://avatars.githubusercontent.com/u/2619092?v=3","gravatar_id":"","url":"https://api.github.com/users/hoppenichu","html_url":"https://github.com/hoppenichu","followers_url":"https://api.github.com/users/hoppenichu/followers","following_url":"https://api.github.com/users/hoppenichu/following{/other_user}","gists_url":"https://api.github.com/users/hoppenichu/gists{/gist_id}","starred_url":"https://api.github.com/users/hoppenichu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoppenichu/subscriptions","organizations_url":"https://api.github.com/users/hoppenichu/orgs","repos_url":"https://api.github.com/users/hoppenichu/repos","events_url":"https://api.github.com/users/hoppenichu/events{/privacy}","received_events_url":"https://api.github.com/users/hoppenichu/received_events","type":"User","site_admin":false},"repo":null},"base":{"label":"rs:master","ref":"master","sha":"feca1e8d0d6ed2a70baeb45f849033f1b137d34b","user":{"login":"rs","id":68232,"avatar_url":"https://avatars.githubusercontent.com/u/68232?v=3","gravatar_id":"","url":"https://api.github.com/users/rs","html_url":"https://github.com/rs","followers_url":"https://api.github.com/users/rs/followers","following_url":"https://api.github.com/users/rs/following{/other_user}","gists_url":"https://api.github.com/users/rs/gists{/gist_id}","starred_url":"https://api.github.com/users/rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rs/subscriptions","organizations_url":"https://api.github.com/users/rs/orgs","repos_url":"https://api.github.com/users/rs/repos","events_url":"https://api.github.com/users/rs/events{/privacy}","received_events_url":"https://api.github.com/users/rs/received_events","type":"User","site_admin":false},"repo":{"id":313419,"name":"SDWebImage","full_name":"rs/SDWebImage","owner":{"login":"rs","id":68232,"avatar_url":"https://avatars.githubusercontent.com/u/68232?v=3","gravatar_id":"","url":"https://api.github.com/users/rs","html_url":"https://github.com/rs","followers_url":"https://api.github.com/users/rs/followers","following_url":"https://api.github.com/users/rs/following{/other_user}","gists_url":"https://api.github.com/users/rs/gists{/gist_id}","starred_url":"https://api.github.com/users/rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rs/subscriptions","organizations_url":"https://api.github.com/users/rs/orgs","repos_url":"https://api.github.com/users/rs/repos","events_url":"https://api.github.com/users/rs/events{/privacy}","received_events_url":"https://api.github.com/users/rs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rs/SDWebImage","description":"Asynchronous image downloader with cache support with an UIImageView category","fork":false,"url":"https://api.github.com/repos/rs/SDWebImage","forks_url":"https://api.github.com/repos/rs/SDWebImage/forks","keys_url":"https://api.github.com/repos/rs/SDWebImage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rs/SDWebImage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rs/SDWebImage/teams","hooks_url":"https://api.github.com/repos/rs/SDWebImage/hooks","issue_events_url":"https://api.github.com/repos/rs/SDWebImage/issues/events{/number}","events_url":"https://api.github.com/repos/rs/SDWebImage/events","assignees_url":"https://api.github.com/repos/rs/SDWebImage/assignees{/user}","branches_url":"https://api.github.com/repos/rs/SDWebImage/branches{/branch}","tags_url":"https://api.github.com/repos/rs/SDWebImage/tags","blobs_url":"https://api.github.com/repos/rs/SDWebImage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rs/SDWebImage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rs/SDWebImage/git/refs{/sha}","trees_url":"https://api.github.com/repos/rs/SDWebImage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rs/SDWebImage/statuses/{sha}","languages_url":"https://api.github.com/repos/rs/SDWebImage/languages","stargazers_url":"https://api.github.com/repos/rs/SDWebImage/stargazers","contributors_url":"https://api.github.com/repos/rs/SDWebImage/contributors","subscribers_url":"https://api.github.com/repos/rs/SDWebImage/subscribers","subscription_url":"https://api.github.com/repos/rs/SDWebImage/subscription","commits_url":"https://api.github.com/repos/rs/SDWebImage/commits{/sha}","git_commits_url":"https://api.github.com/repos/rs/SDWebImage/git/commits{/sha}","comments_url":"https://api.github.com/repos/rs/SDWebImage/comments{/number}","issue_comment_url":"https://api.github.com/repos/rs/SDWebImage/issues/comments{/number}","contents_url":"https://api.github.com/repos/rs/SDWebImage/contents/{+path}","compare_url":"https://api.github.com/repos/rs/SDWebImage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rs/SDWebImage/merges","archive_url":"https://api.github.com/repos/rs/SDWebImage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rs/SDWebImage/downloads","issues_url":"https://api.github.com/repos/rs/SDWebImage/issues{/number}","pulls_url":"https://api.github.com/repos/rs/SDWebImage/pulls{/number}","milestones_url":"https://api.github.com/repos/rs/SDWebImage/milestones{/number}","notifications_url":"https://api.github.com/repos/rs/SDWebImage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rs/SDWebImage/labels{/name}","releases_url":"https://api.github.com/repos/rs/SDWebImage/releases{/id}","created_at":"2009-09-21T17:39:19Z","updated_at":"2015-02-25T19:20:37Z","pushed_at":"2015-02-25T15:54:45Z","git_url":"git://github.com/rs/SDWebImage.git","ssh_url":"git@github.com:rs/SDWebImage.git","clone_url":"https://github.com/rs/SDWebImage.git","svn_url":"https://github.com/rs/SDWebImage","homepage":"http://hackemist.com/SDWebImage/doc","size":6929,"stargazers_count":7812,"watchers_count":7812,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2140,"mirror_url":null,"open_issues_count":120,"forks":2140,"open_issues":120,"watchers":7812,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/1046"},"html":{"href":"https://github.com/rs/SDWebImage/pull/1046"},"issue":{"href":"https://api.github.com/repos/rs/SDWebImage/issues/1046"},"comments":{"href":"https://api.github.com/repos/rs/SDWebImage/issues/1046/comments"},"review_comments":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/1046/comments"},"review_comment":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/1046/commits"},"statuses":{"href":"https://api.github.com/repos/rs/SDWebImage/statuses/f8c7b9014c4e77bb3901469d254dfaa2c556cd9f"}}}}