{"action":"created","issue":{"url":"https://api.github.com/repos/elliotwoods/ofxKinectForWindows2/issues/22","labels_url":"https://api.github.com/repos/elliotwoods/ofxKinectForWindows2/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/elliotwoods/ofxKinectForWindows2/issues/22/comments","events_url":"https://api.github.com/repos/elliotwoods/ofxKinectForWindows2/issues/22/events","html_url":"https://github.com/elliotwoods/ofxKinectForWindows2/issues/22","id":59327384,"number":22,"title":"Error initializing BodySource (Fix Included)","user":{"login":"rickbarraza","id":3167449,"avatar_url":"https://avatars.githubusercontent.com/u/3167449?v=3","gravatar_id":"","url":"https://api.github.com/users/rickbarraza","html_url":"https://github.com/rickbarraza","followers_url":"https://api.github.com/users/rickbarraza/followers","following_url":"https://api.github.com/users/rickbarraza/following{/other_user}","gists_url":"https://api.github.com/users/rickbarraza/gists{/gist_id}","starred_url":"https://api.github.com/users/rickbarraza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickbarraza/subscriptions","organizations_url":"https://api.github.com/users/rickbarraza/orgs","repos_url":"https://api.github.com/users/rickbarraza/repos","events_url":"https://api.github.com/users/rickbarraza/events{/privacy}","received_events_url":"https://api.github.com/users/rickbarraza/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-28T05:53:48Z","updated_at":"2015-02-28T06:20:55Z","closed_at":null,"body":"ENVIRONMENT:\r\nWorking with the OF 0.8.4 tagged branch of the ofxKinectForWindows2 addon, with Visual Studio 2012 Express and the current, official release of OF 0.8.4 as defined here: http://rbarraza.com/setting-up-kinect-2-for-openframeworks/\r\n\r\nISSUE:\r\nAdding \"kinect.initBodySource();\" in your ofApp.cpp > setup() function causes an ACCESS VIOLATION error in \"ofxKinectForWindows2\\Source\\Body.cpp\" line 120:\r\n\r\n120:    if (FAILED(frame->GetAndRefreshBodyData(_countof(ppBodies), ppBodies))){\r\n121:\t\tthrow Exception(\"Failed to refresh body data\");\r\n122:\t    }\r\n\r\nSOLUTION:\r\nBy comparing the master branch, you'll see that ppBodies isn't properly initialized before being called. So simply add the definition before calling it like so:\r\n\r\n\r\n120:    IBody* ppBodies[BODY_COUNT] = {0};  // <-- this is the fix.\r\n121:    if (FAILED(frame->GetAndRefreshBodyData(_countof(ppBodies), ppBodies))){\r\n122:          throw Exception(\"Failed to refresh body data\");\r\n123:\t   }\r\n\r\nAnd you're good to go.\r\n\r\nLet me know when you update, I'll be posting a skeletal tutorial next.\r\n"},"comment":{"url":"https://api.github.com/repos/elliotwoods/ofxKinectForWindows2/issues/comments/76513384","html_url":"https://github.com/elliotwoods/ofxKinectForWindows2/issues/22#issuecomment-76513384","issue_url":"https://api.github.com/repos/elliotwoods/ofxKinectForWindows2/issues/22","id":76513384,"user":{"login":"elliotwoods","id":328294,"avatar_url":"https://avatars.githubusercontent.com/u/328294?v=3","gravatar_id":"","url":"https://api.github.com/users/elliotwoods","html_url":"https://github.com/elliotwoods","followers_url":"https://api.github.com/users/elliotwoods/followers","following_url":"https://api.github.com/users/elliotwoods/following{/other_user}","gists_url":"https://api.github.com/users/elliotwoods/gists{/gist_id}","starred_url":"https://api.github.com/users/elliotwoods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elliotwoods/subscriptions","organizations_url":"https://api.github.com/users/elliotwoods/orgs","repos_url":"https://api.github.com/users/elliotwoods/repos","events_url":"https://api.github.com/users/elliotwoods/events{/privacy}","received_events_url":"https://api.github.com/users/elliotwoods/received_events","type":"User","site_admin":false},"created_at":"2015-02-28T06:20:55Z","updated_at":"2015-02-28T06:20:55Z","body":"ok i'll have a look at this today\r\n\r\naha yes\r\nthis fix is already in 0.9.0:\r\nhttps://github.com/elliotwoods/ofxKinectForWindows2/blob/master/src/ofxKinectForWindows2/Source/Body.cpp#L75\r\n\r\ni'm tempted to combine both versions (using ifdefs to handle the different syntax between 0.8.4 and 0.9.0 rather than different tags)\r\n\r\nwill fix today"}}