mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Delete Leap and RealSense devices on shutdown
Leaving them running prevents a clean shutdown on Windows when running Interface.exe from a command line: the interface.exe process stays alive preventing Interface from being run again from the command line without manually terminating the running process.
This commit is contained in:
parent
bb77ba95d0
commit
e20df0e2bf
7 changed files with 24 additions and 0 deletions
|
@ -690,6 +690,9 @@ Application::~Application() {
|
|||
nodeThread->quit();
|
||||
nodeThread->wait();
|
||||
|
||||
Leapmotion::destroy();
|
||||
RealSense::destroy();
|
||||
|
||||
qInstallMessageHandler(NULL); // NOTE: Do this as late as possible so we continue to get our log messages
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,13 @@ DeviceTracker::ID DeviceTracker::registerDevice(const Name& name, DeviceTracker*
|
|||
return deviceID;
|
||||
}
|
||||
|
||||
void DeviceTracker::destroyDevice(const Name& name) {
|
||||
DeviceTracker::ID deviceID = getDeviceID(name);
|
||||
if (deviceID != INVALID_DEVICE) {
|
||||
delete Singleton::get()->_devicesVector[getDeviceID(name)];
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceTracker::updateAll() {
|
||||
//TODO C++11 for (auto deviceIt = Singleton::get()->_devicesVector.begin(); deviceIt != Singleton::get()->_devicesVector.end(); deviceIt++) {
|
||||
for (Vector::iterator deviceIt = Singleton::get()->_devicesVector.begin(); deviceIt != Singleton::get()->_devicesVector.end(); deviceIt++) {
|
||||
|
|
|
@ -79,6 +79,8 @@ public:
|
|||
/// INVALID_DEVICE_NAME if the name is already taken
|
||||
static ID registerDevice(const Name& name, DeviceTracker* tracker);
|
||||
|
||||
static void destroyDevice(const Name& name);
|
||||
|
||||
// DeviceTracker interface
|
||||
|
||||
virtual void update();
|
||||
|
|
|
@ -50,6 +50,11 @@ void Leapmotion::init() {
|
|||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void Leapmotion::destroy() {
|
||||
DeviceTracker::destroyDevice(NAME);
|
||||
}
|
||||
|
||||
// static
|
||||
Leapmotion* Leapmotion::getInstance() {
|
||||
DeviceTracker* device = DeviceTracker::getDevice(NAME);
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
static const Name NAME;
|
||||
|
||||
static void init();
|
||||
static void destroy();
|
||||
|
||||
/// Leapmotion MotionTracker factory
|
||||
static Leapmotion* getInstance();
|
||||
|
|
|
@ -54,6 +54,11 @@ void RealSense::init() {
|
|||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void RealSense::destroy() {
|
||||
DeviceTracker::destroyDevice(NAME);
|
||||
}
|
||||
|
||||
// static
|
||||
RealSense* RealSense::getInstance() {
|
||||
DeviceTracker* device = DeviceTracker::getDevice(NAME);
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
static const Name NAME;
|
||||
|
||||
static void init();
|
||||
static void destroy();
|
||||
|
||||
/// RealSense MotionTracker factory
|
||||
static RealSense* getInstance();
|
||||
|
|
Loading…
Reference in a new issue