{"action":"created","issue":{"url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/784","repository_url":"https://api.github.com/repos/ResearchKit/ResearchKit","labels_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/784/labels{/name}","comments_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/784/comments","events_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/784/events","html_url":"https://github.com/ResearchKit/ResearchKit/issues/784","id":170654836,"number":784,"title":"ORKSignatureView uses invalid graphics context","user":{"login":"oliverschaefer","id":13077832,"avatar_url":"https://avatars.githubusercontent.com/u/13077832?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverschaefer","html_url":"https://github.com/oliverschaefer","followers_url":"https://api.github.com/users/oliverschaefer/followers","following_url":"https://api.github.com/users/oliverschaefer/following{/other_user}","gists_url":"https://api.github.com/users/oliverschaefer/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverschaefer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverschaefer/subscriptions","organizations_url":"https://api.github.com/users/oliverschaefer/orgs","repos_url":"https://api.github.com/users/oliverschaefer/repos","events_url":"https://api.github.com/users/oliverschaefer/events{/privacy}","received_events_url":"https://api.github.com/users/oliverschaefer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ResearchKit/ResearchKit/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-11T14:09:00Z","updated_at":"2016-08-31T04:51:43Z","closed_at":null,"body":"Steps to reproduce\r\n-\r\n* Setup an `ORKOrderedTask` containing a single `ORKSignatureStep`\r\n* Attach this task to an `ORKTaskViewController` and present it\r\n* Once the task finishes, save the task view controller's restoration data\r\n* Instantiate a `ORKTaskViewController` with the saved restoration data\r\n* Access the `result` property of the newly instantiated task view controller\r\n\r\nExpected behavior\r\n-\r\n* No warning messages printed to the console\r\n\r\nActual behavior\r\n-\r\n* `invalid context 0x0` error messages printed to the console\r\n\r\nRoot cause\r\n-\r\n* `ORKTaskViewController`'s state restoration routine will recreate the `ORKSignatureStepViewController`\r\n* The recreated step view controller will be shown, which leads to a `viewWillAppear`call even if the task view controller itself hasn't been presented so far\r\n* Within it's `viewWillAppear` implementation `ORKSignatureStepViewController` copies the path array of the restored step result. Therefore, `ORKSignatureView`'s `signatureExists` property will return `YES`\r\n* Once the result property of is accessed, `ORKTaskViewController` updates the current step result, which accesses `ORKSignatureStepViewController`'s result property\r\n* Since `signatureExists` returns `YES`, `ORKSignatureStepViewController` instantiates a new `ORKSignatureResult` and accesses the `signatureImage` property of `ORKSignatureView`\r\n* This access leads to a `UIGraphicsBeginImageContext` call that passes `self.bounds.size`\r\n* Since the view hasn't actually appeared on screen, both width and height are 0, which leads to an invalid image context\r\n\r\nProposed fix\r\n-\r\n* If either `self.bounds.height`or `self.bounds.width` are 0, return a default size to create the image context\r\n\r\n@syoung-smallwisdom Please have a look at this"},"comment":{"url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/comments/243657820","html_url":"https://github.com/ResearchKit/ResearchKit/issues/784#issuecomment-243657820","issue_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/784","id":243657820,"user":{"login":"syoung-smallwisdom","id":5649217,"avatar_url":"https://avatars.githubusercontent.com/u/5649217?v=3","gravatar_id":"","url":"https://api.github.com/users/syoung-smallwisdom","html_url":"https://github.com/syoung-smallwisdom","followers_url":"https://api.github.com/users/syoung-smallwisdom/followers","following_url":"https://api.github.com/users/syoung-smallwisdom/following{/other_user}","gists_url":"https://api.github.com/users/syoung-smallwisdom/gists{/gist_id}","starred_url":"https://api.github.com/users/syoung-smallwisdom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syoung-smallwisdom/subscriptions","organizations_url":"https://api.github.com/users/syoung-smallwisdom/orgs","repos_url":"https://api.github.com/users/syoung-smallwisdom/repos","events_url":"https://api.github.com/users/syoung-smallwisdom/events{/privacy}","received_events_url":"https://api.github.com/users/syoung-smallwisdom/received_events","type":"User","site_admin":false},"created_at":"2016-08-31T04:51:43Z","updated_at":"2016-08-31T04:51:43Z","body":"@oliverschaefer \r\nSorry, I was on vacation when this came in and then I forgot to reply. I think your solution is a good one. Would you like for me to address the issue or would you prefer to submit your own fix? Thanks!"}}
{"actor":{"display_login":"syoung-smallwisdom"}}