{"action":"created","issue":{"url":"https://api.github.com/repos/Karumi/Dexter/issues/44","labels_url":"https://api.github.com/repos/Karumi/Dexter/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/Karumi/Dexter/issues/44/comments","events_url":"https://api.github.com/repos/Karumi/Dexter/issues/44/events","html_url":"https://github.com/Karumi/Dexter/pull/44","id":128136244,"number":44,"title":"Fix race condition","user":{"login":"Serchinastico","id":3116415,"avatar_url":"https://avatars.githubusercontent.com/u/3116415?v=3","gravatar_id":"","url":"https://api.github.com/users/Serchinastico","html_url":"https://github.com/Serchinastico","followers_url":"https://api.github.com/users/Serchinastico/followers","following_url":"https://api.github.com/users/Serchinastico/following{/other_user}","gists_url":"https://api.github.com/users/Serchinastico/gists{/gist_id}","starred_url":"https://api.github.com/users/Serchinastico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Serchinastico/subscriptions","organizations_url":"https://api.github.com/users/Serchinastico/orgs","repos_url":"https://api.github.com/users/Serchinastico/repos","events_url":"https://api.github.com/users/Serchinastico/events{/privacy}","received_events_url":"https://api.github.com/users/Serchinastico/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-22T11:25:45Z","updated_at":"2016-01-22T11:31:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Karumi/Dexter/pulls/44","html_url":"https://github.com/Karumi/Dexter/pull/44","diff_url":"https://github.com/Karumi/Dexter/pull/44.diff","patch_url":"https://github.com/Karumi/Dexter/pull/44.patch"},"body":"There is a race condition causing crashes in some situations.\r\n\r\nThe flow is the following:\r\n\r\n1. Begin `continuePendingRequestIfPossible`\r\n2. `pendingPermissions` is NOT empty\r\n3. `rationaleAccepted` has NOT been accepted\r\n4. --- Previous thread executes `onPermissionsChecked`\r\n5. --- Clean pending permissions, rationaleAccepted and all internal state, including `this.activity`\r\n6. Call `onActivityReady` with `this.activity`\r\n7. `androidPermissionService.checkSelfPermission(activity, permission);` causes a NPE\r\n\r\nSolution: Create a mutex separating execution of two critical snippets, the one cleaning the activity and the one using it to check for permissions."},"comment":{"url":"https://api.github.com/repos/Karumi/Dexter/issues/comments/173890896","html_url":"https://github.com/Karumi/Dexter/pull/44#issuecomment-173890896","issue_url":"https://api.github.com/repos/Karumi/Dexter/issues/44","id":173890896,"user":{"login":"pedrovgs","id":4030704,"avatar_url":"https://avatars.githubusercontent.com/u/4030704?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrovgs","html_url":"https://github.com/pedrovgs","followers_url":"https://api.github.com/users/pedrovgs/followers","following_url":"https://api.github.com/users/pedrovgs/following{/other_user}","gists_url":"https://api.github.com/users/pedrovgs/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrovgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrovgs/subscriptions","organizations_url":"https://api.github.com/users/pedrovgs/orgs","repos_url":"https://api.github.com/users/pedrovgs/repos","events_url":"https://api.github.com/users/pedrovgs/events{/privacy}","received_events_url":"https://api.github.com/users/pedrovgs/received_events","type":"User","site_admin":false},"created_at":"2016-01-22T11:31:49Z","updated_at":"2016-01-22T11:31:49Z","body":":+1: Thanks for the fix @Serchinastico are we going to publish a new version?"}}