{"action":"created","issue":{"url":"https://api.github.com/repos/3dtof/voxelsdk/issues/152","repository_url":"https://api.github.com/repos/3dtof/voxelsdk","labels_url":"https://api.github.com/repos/3dtof/voxelsdk/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/3dtof/voxelsdk/issues/152/comments","events_url":"https://api.github.com/repos/3dtof/voxelsdk/issues/152/events","html_url":"https://github.com/3dtof/voxelsdk/issues/152","id":332893130,"node_id":"MDU6SXNzdWUzMzI4OTMxMzA=","number":152,"title":"Access violation when registering callback","user":{"login":"dlangerm","id":13711976,"node_id":"MDQ6VXNlcjEzNzExOTc2","avatar_url":"https://avatars1.githubusercontent.com/u/13711976?v=4","gravatar_id":"","url":"https://api.github.com/users/dlangerm","html_url":"https://github.com/dlangerm","followers_url":"https://api.github.com/users/dlangerm/followers","following_url":"https://api.github.com/users/dlangerm/following{/other_user}","gists_url":"https://api.github.com/users/dlangerm/gists{/gist_id}","starred_url":"https://api.github.com/users/dlangerm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlangerm/subscriptions","organizations_url":"https://api.github.com/users/dlangerm/orgs","repos_url":"https://api.github.com/users/dlangerm/repos","events_url":"https://api.github.com/users/dlangerm/events{/privacy}","received_events_url":"https://api.github.com/users/dlangerm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-15T19:42:57Z","updated_at":"2018-06-18T14:20:43Z","closed_at":null,"author_association":"NONE","body":"I have a function that sets up my TinTinCDK Camera with a callback declared as a lambda function, the setup function is below:\r\n\r\n\r\n```\r\n// Based on TOFApp.cpp\r\nvoid setupCam(Voxel::DepthCameraPtr depthCamera) {\r\n\r\n\tuint bpp = 0;\r\n\tcout << \"Connected to camera with bpp = \" << depthCamera->getBytesPerPixel(bpp) << \"\\n\";\r\n\t\r\n\tdepthCamera->registerCallback(DepthCamera::FRAME_DEPTH_FRAME, frameCallback);\r\n\r\n\tif (depthCamera->start()) {\r\n\t\tFrameRate r;\r\n\t\tif (depthCamera->getFrameRate(r))\r\n\t\t\tlogger(LOG_INFO) << \"Capturing at a frame rate of \" << r.getFrameRate() << \" fps\" << std::endl;\r\n\t\tdepthCamera->wait();\r\n\t}\r\n}\r\n\r\n```\r\nThe lambda function is here:\r\n\r\n\r\n```\r\nauto frameCallback = [](Voxel::DepthCamera &dc, const Voxel::Frame &frame, Voxel::DepthCamera::FrameType callBackType) {\r\n\tif (callBackType == Voxel::DepthCamera::FrameType::FRAME_DEPTH_FRAME) {\r\n\t\tcout << \"This is a callback for the depth frame!!!!\\n\";\r\n\t} else {\r\n\t\tcout << \"This is a callback for something else\\n\";\r\n\t}\r\n};\r\n```\r\n\r\n\r\nI get this error immediately after calling \r\n`depthCamera->registerCallback(DepthCamera::FRAME_DEPTH_FRAME, frameCallback);`\r\n\r\n> Exception thrown at 0x00007FFF3EA49FCD (voxel.dll) in depth-upsampling.exe: 0xC0000005: Access violation reading location 0x0000006500780065.\r\n\r\nThe ToF camera is definitely located and is initialized properly. I have tried a lot of different ways of declaring the lambda, resetting the depth camera before calling registerCallback, capturing all autos in the lambda, capturing nothing, etc. Nothing seems to be working. Any help would be appreciated. Thanks.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/3dtof/voxelsdk/issues/comments/398070764","html_url":"https://github.com/3dtof/voxelsdk/issues/152#issuecomment-398070764","issue_url":"https://api.github.com/repos/3dtof/voxelsdk/issues/152","id":398070764,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODA3MDc2NA==","user":{"login":"dlangerm","id":13711976,"node_id":"MDQ6VXNlcjEzNzExOTc2","avatar_url":"https://avatars1.githubusercontent.com/u/13711976?v=4","gravatar_id":"","url":"https://api.github.com/users/dlangerm","html_url":"https://github.com/dlangerm","followers_url":"https://api.github.com/users/dlangerm/followers","following_url":"https://api.github.com/users/dlangerm/following{/other_user}","gists_url":"https://api.github.com/users/dlangerm/gists{/gist_id}","starred_url":"https://api.github.com/users/dlangerm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlangerm/subscriptions","organizations_url":"https://api.github.com/users/dlangerm/orgs","repos_url":"https://api.github.com/users/dlangerm/repos","events_url":"https://api.github.com/users/dlangerm/events{/privacy}","received_events_url":"https://api.github.com/users/dlangerm/received_events","type":"User","site_admin":false},"created_at":"2018-06-18T14:20:43Z","updated_at":"2018-06-18T14:20:43Z","author_association":"NONE","body":"Note: This was a problem with the MSVC compiler optimizing away the shared pointer for the depth camera. It is fixed by removing /O2 in the C/C++ Optimization options."}}
{"actor":{"display_login":"dlangerm"}}