{"action":"created","comment":{"url":"https://api.github.com/repos/leapmotion/autowiring/pulls/comments/43169539","id":43169539,"diff_hunk":"@@ -300,81 +301,78 @@ void CoreContext::AddInternal(const AnySharedPointer& ptr) {\n \n   // Verify that this type isn't already satisfied\n   MemoEntry& entry = m_typeMemos[ptr.type()];\n-  if (entry.m_value)\n+  if (entry.m_local && entry.m_value)\n     throw autowiring_error(\"This interface is already present in the context\");\n \n   // Now we can satisfy it:\n+  entry.m_local = true;\n   entry.m_value = ptr;\n   UpdateDeferredElement(std::move(lk), entry);\n }\n \n-MemoEntry& CoreContext::FindByType(AnySharedPointer& reference, bool localOnly) const {\n+MemoEntry& CoreContext::FindByType(auto_id type, bool nonrecursive) const {","path":"src/autowiring/CoreContext.cpp","position":55,"original_position":55,"commit_id":"8dd3ec682330143cd11bc8d807ff4051ef6cd0a9","original_commit_id":"8dd3ec682330143cd11bc8d807ff4051ef6cd0a9","user":{"login":"codemercenary","id":2961036,"avatar_url":"https://avatars.githubusercontent.com/u/2961036?v=3","gravatar_id":"","url":"https://api.github.com/users/codemercenary","html_url":"https://github.com/codemercenary","followers_url":"https://api.github.com/users/codemercenary/followers","following_url":"https://api.github.com/users/codemercenary/following{/other_user}","gists_url":"https://api.github.com/users/codemercenary/gists{/gist_id}","starred_url":"https://api.github.com/users/codemercenary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codemercenary/subscriptions","organizations_url":"https://api.github.com/users/codemercenary/orgs","repos_url":"https://api.github.com/users/codemercenary/repos","events_url":"https://api.github.com/users/codemercenary/events{/privacy}","received_events_url":"https://api.github.com/users/codemercenary/received_events","type":"User","site_admin":false},"body":"Are you sure this breaks compatibility?  `CoreContext.h:1107` provides the shared pointer version of this routine.","created_at":"2015-10-27T18:56:21Z","updated_at":"2015-10-27T18:56:21Z","html_url":"https://github.com/leapmotion/autowiring/pull/796#discussion_r43169539","pull_request_url":"https://api.github.com/repos/leapmotion/autowiring/pulls/796","_links":{"self":{"href":"https://api.github.com/repos/leapmotion/autowiring/pulls/comments/43169539"},"html":{"href":"https://github.com/leapmotion/autowiring/pull/796#discussion_r43169539"},"pull_request":{"href":"https://api.github.com/repos/leapmotion/autowiring/pulls/796"}}},"pull_request":{"url":"https://api.github.com/repos/leapmotion/autowiring/pulls/796","id":48644981,"html_url":"https://github.com/leapmotion/autowiring/pull/796","diff_url":"https://github.com/leapmotion/autowiring/pull/796.diff","patch_url":"https://github.com/leapmotion/autowiring/pull/796.patch","issue_url":"https://api.github.com/repos/leapmotion/autowiring/issues/796","number":796,"state":"closed","locked":false,"title":"Address unsynchronized reset issue","user":{"login":"codemercenary","id":2961036,"avatar_url":"https://avatars.githubusercontent.com/u/2961036?v=3","gravatar_id":"","url":"https://api.github.com/users/codemercenary","html_url":"https://github.com/codemercenary","followers_url":"https://api.github.com/users/codemercenary/followers","following_url":"https://api.github.com/users/codemercenary/following{/other_user}","gists_url":"https://api.github.com/users/codemercenary/gists{/gist_id}","starred_url":"https://api.github.com/users/codemercenary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codemercenary/subscriptions","organizations_url":"https://api.github.com/users/codemercenary/orgs","repos_url":"https://api.github.com/users/codemercenary/repos","events_url":"https://api.github.com/users/codemercenary/events{/privacy}","received_events_url":"https://api.github.com/users/codemercenary/received_events","type":"User","site_admin":false},"body":"This pull request only partially addresses the asynchronous reset problem.  There is no general solution to this problem because at the heart of the issue is a cancellation race with `NotifyWhenAutowired`.  The simplest case that demonstrates this issue is as follows:\r\n\r\nThread 1:\r\n```C++\r\n{\r\n    std::lock_guard<std::mutex> lk(lock);\r\n    Autowired<T> ptr;\r\n    ptr->NotifyWhenAutowired([&] {\r\n        std::lock_guard<std::mutex> lk(lock);\r\n        // ...do more work...\r\n    });\r\n    std::this_thread::sleep_for(std::chrono::seconds(1));\r\n}\r\n```\r\n\r\nIf `T` is injected during the sleep, the callback will be invoked and the injecting thread will block on the lock acquisition attempt.  The sleeping thread wakes up, and tries to destroy `ptr`.  This causes `DeferrableAutowiring::~DeferrableAutowiring()` to be called.\r\n\r\n1.  If this destructor blocks until all registered handlers have been cancelled, a deadlock results.\r\n2.  If it cancels on a best-effort basis, a potential use-after-free results.\r\n\r\nThe only solution is to require that users externally synchronize `Autowired::~Autowired` with `CoreContext::Inject`.","created_at":"2015-10-24T01:01:45Z","updated_at":"2015-10-27T18:56:21Z","closed_at":"2015-10-27T06:52:22Z","merged_at":"2015-10-27T06:52:22Z","merge_commit_sha":"1d10f5f51e96e840f74e56378e75b728366828ef","assignee":{"login":"veronicaz41","id":14994260,"avatar_url":"https://avatars.githubusercontent.com/u/14994260?v=3","gravatar_id":"","url":"https://api.github.com/users/veronicaz41","html_url":"https://github.com/veronicaz41","followers_url":"https://api.github.com/users/veronicaz41/followers","following_url":"https://api.github.com/users/veronicaz41/following{/other_user}","gists_url":"https://api.github.com/users/veronicaz41/gists{/gist_id}","starred_url":"https://api.github.com/users/veronicaz41/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veronicaz41/subscriptions","organizations_url":"https://api.github.com/users/veronicaz41/orgs","repos_url":"https://api.github.com/users/veronicaz41/repos","events_url":"https://api.github.com/users/veronicaz41/events{/privacy}","received_events_url":"https://api.github.com/users/veronicaz41/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/leapmotion/autowiring/milestones/4","html_url":"https://github.com/leapmotion/autowiring/milestones/v0.7.6","labels_url":"https://api.github.com/repos/leapmotion/autowiring/milestones/4/labels","id":1357675,"number":4,"title":"v0.7.6","description":"We've got fixes in here now that need to be released downstream, time to set a date.","creator":{"login":"codemercenary","id":2961036,"avatar_url":"https://avatars.githubusercontent.com/u/2961036?v=3","gravatar_id":"","url":"https://api.github.com/users/codemercenary","html_url":"https://github.com/codemercenary","followers_url":"https://api.github.com/users/codemercenary/followers","following_url":"https://api.github.com/users/codemercenary/following{/other_user}","gists_url":"https://api.github.com/users/codemercenary/gists{/gist_id}","starred_url":"https://api.github.com/users/codemercenary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codemercenary/subscriptions","organizations_url":"https://api.github.com/users/codemercenary/orgs","repos_url":"https://api.github.com/users/codemercenary/repos","events_url":"https://api.github.com/users/codemercenary/events{/privacy}","received_events_url":"https://api.github.com/users/codemercenary/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":26,"state":"open","created_at":"2015-10-15T16:44:33Z","updated_at":"2015-10-27T18:03:54Z","due_on":"2015-10-21T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/leapmotion/autowiring/pulls/796/commits","review_comments_url":"https://api.github.com/repos/leapmotion/autowiring/pulls/796/comments","review_comment_url":"https://api.github.com/repos/leapmotion/autowiring/pulls/comments{/number}","comments_url":"https://api.github.com/repos/leapmotion/autowiring/issues/796/comments","statuses_url":"https://api.github.com/repos/leapmotion/autowiring/statuses/8dd3ec682330143cd11bc8d807ff4051ef6cd0a9","head":{"label":"leapmotion:bug-awreset","ref":"bug-awreset","sha":"8dd3ec682330143cd11bc8d807ff4051ef6cd0a9","user":{"login":"leapmotion","id":2242710,"avatar_url":"https://avatars.githubusercontent.com/u/2242710?v=3","gravatar_id":"","url":"https://api.github.com/users/leapmotion","html_url":"https://github.com/leapmotion","followers_url":"https://api.github.com/users/leapmotion/followers","following_url":"https://api.github.com/users/leapmotion/following{/other_user}","gists_url":"https://api.github.com/users/leapmotion/gists{/gist_id}","starred_url":"https://api.github.com/users/leapmotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leapmotion/subscriptions","organizations_url":"https://api.github.com/users/leapmotion/orgs","repos_url":"https://api.github.com/users/leapmotion/repos","events_url":"https://api.github.com/users/leapmotion/events{/privacy}","received_events_url":"https://api.github.com/users/leapmotion/received_events","type":"Organization","site_admin":false},"repo":{"id":22234733,"name":"autowiring","full_name":"leapmotion/autowiring","owner":{"login":"leapmotion","id":2242710,"avatar_url":"https://avatars.githubusercontent.com/u/2242710?v=3","gravatar_id":"","url":"https://api.github.com/users/leapmotion","html_url":"https://github.com/leapmotion","followers_url":"https://api.github.com/users/leapmotion/followers","following_url":"https://api.github.com/users/leapmotion/following{/other_user}","gists_url":"https://api.github.com/users/leapmotion/gists{/gist_id}","starred_url":"https://api.github.com/users/leapmotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leapmotion/subscriptions","organizations_url":"https://api.github.com/users/leapmotion/orgs","repos_url":"https://api.github.com/users/leapmotion/repos","events_url":"https://api.github.com/users/leapmotion/events{/privacy}","received_events_url":"https://api.github.com/users/leapmotion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/leapmotion/autowiring","description":"A C++ Inversion of Control Framework","fork":false,"url":"https://api.github.com/repos/leapmotion/autowiring","forks_url":"https://api.github.com/repos/leapmotion/autowiring/forks","keys_url":"https://api.github.com/repos/leapmotion/autowiring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leapmotion/autowiring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leapmotion/autowiring/teams","hooks_url":"https://api.github.com/repos/leapmotion/autowiring/hooks","issue_events_url":"https://api.github.com/repos/leapmotion/autowiring/issues/events{/number}","events_url":"https://api.github.com/repos/leapmotion/autowiring/events","assignees_url":"https://api.github.com/repos/leapmotion/autowiring/assignees{/user}","branches_url":"https://api.github.com/repos/leapmotion/autowiring/branches{/branch}","tags_url":"https://api.github.com/repos/leapmotion/autowiring/tags","blobs_url":"https://api.github.com/repos/leapmotion/autowiring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leapmotion/autowiring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leapmotion/autowiring/git/refs{/sha}","trees_url":"https://api.github.com/repos/leapmotion/autowiring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leapmotion/autowiring/statuses/{sha}","languages_url":"https://api.github.com/repos/leapmotion/autowiring/languages","stargazers_url":"https://api.github.com/repos/leapmotion/autowiring/stargazers","contributors_url":"https://api.github.com/repos/leapmotion/autowiring/contributors","subscribers_url":"https://api.github.com/repos/leapmotion/autowiring/subscribers","subscription_url":"https://api.github.com/repos/leapmotion/autowiring/subscription","commits_url":"https://api.github.com/repos/leapmotion/autowiring/commits{/sha}","git_commits_url":"https://api.github.com/repos/leapmotion/autowiring/git/commits{/sha}","comments_url":"https://api.github.com/repos/leapmotion/autowiring/comments{/number}","issue_comment_url":"https://api.github.com/repos/leapmotion/autowiring/issues/comments{/number}","contents_url":"https://api.github.com/repos/leapmotion/autowiring/contents/{+path}","compare_url":"https://api.github.com/repos/leapmotion/autowiring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leapmotion/autowiring/merges","archive_url":"https://api.github.com/repos/leapmotion/autowiring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leapmotion/autowiring/downloads","issues_url":"https://api.github.com/repos/leapmotion/autowiring/issues{/number}","pulls_url":"https://api.github.com/repos/leapmotion/autowiring/pulls{/number}","milestones_url":"https://api.github.com/repos/leapmotion/autowiring/milestones{/number}","notifications_url":"https://api.github.com/repos/leapmotion/autowiring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leapmotion/autowiring/labels{/name}","releases_url":"https://api.github.com/repos/leapmotion/autowiring/releases{/id}","created_at":"2014-07-24T22:39:49Z","updated_at":"2015-10-21T02:04:41Z","pushed_at":"2015-10-27T18:54:04Z","git_url":"git://github.com/leapmotion/autowiring.git","ssh_url":"git@github.com:leapmotion/autowiring.git","clone_url":"https://github.com/leapmotion/autowiring.git","svn_url":"https://github.com/leapmotion/autowiring","homepage":"http://autowiring.io/","size":43010,"stargazers_count":87,"watchers_count":87,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":87,"default_branch":"develop"}},"base":{"label":"leapmotion:develop","ref":"develop","sha":"dd476de8ae388b4b23e30f60d7dbd8d4682c5ff5","user":{"login":"leapmotion","id":2242710,"avatar_url":"https://avatars.githubusercontent.com/u/2242710?v=3","gravatar_id":"","url":"https://api.github.com/users/leapmotion","html_url":"https://github.com/leapmotion","followers_url":"https://api.github.com/users/leapmotion/followers","following_url":"https://api.github.com/users/leapmotion/following{/other_user}","gists_url":"https://api.github.com/users/leapmotion/gists{/gist_id}","starred_url":"https://api.github.com/users/leapmotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leapmotion/subscriptions","organizations_url":"https://api.github.com/users/leapmotion/orgs","repos_url":"https://api.github.com/users/leapmotion/repos","events_url":"https://api.github.com/users/leapmotion/events{/privacy}","received_events_url":"https://api.github.com/users/leapmotion/received_events","type":"Organization","site_admin":false},"repo":{"id":22234733,"name":"autowiring","full_name":"leapmotion/autowiring","owner":{"login":"leapmotion","id":2242710,"avatar_url":"https://avatars.githubusercontent.com/u/2242710?v=3","gravatar_id":"","url":"https://api.github.com/users/leapmotion","html_url":"https://github.com/leapmotion","followers_url":"https://api.github.com/users/leapmotion/followers","following_url":"https://api.github.com/users/leapmotion/following{/other_user}","gists_url":"https://api.github.com/users/leapmotion/gists{/gist_id}","starred_url":"https://api.github.com/users/leapmotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leapmotion/subscriptions","organizations_url":"https://api.github.com/users/leapmotion/orgs","repos_url":"https://api.github.com/users/leapmotion/repos","events_url":"https://api.github.com/users/leapmotion/events{/privacy}","received_events_url":"https://api.github.com/users/leapmotion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/leapmotion/autowiring","description":"A C++ Inversion of Control Framework","fork":false,"url":"https://api.github.com/repos/leapmotion/autowiring","forks_url":"https://api.github.com/repos/leapmotion/autowiring/forks","keys_url":"https://api.github.com/repos/leapmotion/autowiring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leapmotion/autowiring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leapmotion/autowiring/teams","hooks_url":"https://api.github.com/repos/leapmotion/autowiring/hooks","issue_events_url":"https://api.github.com/repos/leapmotion/autowiring/issues/events{/number}","events_url":"https://api.github.com/repos/leapmotion/autowiring/events","assignees_url":"https://api.github.com/repos/leapmotion/autowiring/assignees{/user}","branches_url":"https://api.github.com/repos/leapmotion/autowiring/branches{/branch}","tags_url":"https://api.github.com/repos/leapmotion/autowiring/tags","blobs_url":"https://api.github.com/repos/leapmotion/autowiring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leapmotion/autowiring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leapmotion/autowiring/git/refs{/sha}","trees_url":"https://api.github.com/repos/leapmotion/autowiring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leapmotion/autowiring/statuses/{sha}","languages_url":"https://api.github.com/repos/leapmotion/autowiring/languages","stargazers_url":"https://api.github.com/repos/leapmotion/autowiring/stargazers","contributors_url":"https://api.github.com/repos/leapmotion/autowiring/contributors","subscribers_url":"https://api.github.com/repos/leapmotion/autowiring/subscribers","subscription_url":"https://api.github.com/repos/leapmotion/autowiring/subscription","commits_url":"https://api.github.com/repos/leapmotion/autowiring/commits{/sha}","git_commits_url":"https://api.github.com/repos/leapmotion/autowiring/git/commits{/sha}","comments_url":"https://api.github.com/repos/leapmotion/autowiring/comments{/number}","issue_comment_url":"https://api.github.com/repos/leapmotion/autowiring/issues/comments{/number}","contents_url":"https://api.github.com/repos/leapmotion/autowiring/contents/{+path}","compare_url":"https://api.github.com/repos/leapmotion/autowiring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leapmotion/autowiring/merges","archive_url":"https://api.github.com/repos/leapmotion/autowiring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leapmotion/autowiring/downloads","issues_url":"https://api.github.com/repos/leapmotion/autowiring/issues{/number}","pulls_url":"https://api.github.com/repos/leapmotion/autowiring/pulls{/number}","milestones_url":"https://api.github.com/repos/leapmotion/autowiring/milestones{/number}","notifications_url":"https://api.github.com/repos/leapmotion/autowiring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leapmotion/autowiring/labels{/name}","releases_url":"https://api.github.com/repos/leapmotion/autowiring/releases{/id}","created_at":"2014-07-24T22:39:49Z","updated_at":"2015-10-21T02:04:41Z","pushed_at":"2015-10-27T18:54:04Z","git_url":"git://github.com/leapmotion/autowiring.git","ssh_url":"git@github.com:leapmotion/autowiring.git","clone_url":"https://github.com/leapmotion/autowiring.git","svn_url":"https://github.com/leapmotion/autowiring","homepage":"http://autowiring.io/","size":43010,"stargazers_count":87,"watchers_count":87,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":87,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/leapmotion/autowiring/pulls/796"},"html":{"href":"https://github.com/leapmotion/autowiring/pull/796"},"issue":{"href":"https://api.github.com/repos/leapmotion/autowiring/issues/796"},"comments":{"href":"https://api.github.com/repos/leapmotion/autowiring/issues/796/comments"},"review_comments":{"href":"https://api.github.com/repos/leapmotion/autowiring/pulls/796/comments"},"review_comment":{"href":"https://api.github.com/repos/leapmotion/autowiring/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/leapmotion/autowiring/pulls/796/commits"},"statuses":{"href":"https://api.github.com/repos/leapmotion/autowiring/statuses/8dd3ec682330143cd11bc8d807ff4051ef6cd0a9"}}}}