Open syedharoonalam opened 8 years ago
By resetting the RealSenseDeviceManager
singleton instance you effectively destroy the underlying PXCSession
. This will break any other grabbers existing within the app (in case you have multiple cameras running). So this does not look like a proper fix to me. Can you please provide more information about the specific problem you are facing?
Sergey,
I am attaching a simple test file: real_sense_viewer.cpp for creating a Dll. For test, you can replace current file in your project with mine, in visual studio change: real_sense_viewer/Properties in Target extension and Configuration Type to .dll. This will create you a dll file.
Another test unity project is attached which simply calls Start_RS_LPM(), this will initiate real sense grabber and viewer, on pressing SHIFT key it will exit loop and call real sense to stop. I have now noticed that on stop only ~RealSenseViewer () and ~RealSenseGrabber () is called but not ~RealSenseDeviceManager () so static pointer variable didn't get released, on exiting unity it throws R6025-pure virtual function call, enclosed here is screen shot.
So as mentioned I tried calling getInstance().reset() in ~RealSenseGrabber () and it worked fine i.e all three destructors get called and I didnt faced error on exiting unity and previous data on calling Start_RS_LPM multiple times.
P.S memory do get free when exiting loop in executable and eventually exit app, there is no issue when running .exe
Regards, Haroon TEST.zip
Haroon, thanks for the explanation. From what you wrote, it feels like a solution would be to provide a function that can be used to explicitly shut down the session. Unfortunately, I have a deadline early next week, so will be able to have a close look at the code you provided only in the second half. I will let you know about my findings.
Great, thanks!
getInstance () at rs/include/real_sense/real_sense_device_manager.h line 76, is defining static pointer variable 'instance' that is not getting reset/destroyed on stop, and caused issue when you need to call start/stop multiple times within same application.