Terminate DDE earlier during shut-down and always at start-up

This commit is contained in:
David Rowe 2015-09-09 11:29:57 -07:00
parent 74c92af8e0
commit 01d7e68dbb
2 changed files with 10 additions and 10 deletions

View file

@ -786,6 +786,14 @@ void Application::aboutToQuit() {
} }
void Application::cleanupBeforeQuit() { void Application::cleanupBeforeQuit() {
// Terminate third party processes so that they're not left running in the event of a subsequent shutdown crash
#ifdef HAVE_DDE
DependencyManager::destroy<DdeFaceTracker>();
#endif
#ifdef HAVE_IVIEWHMD
DependencyManager::destroy<EyeTracker>();
#endif
if (_keyboardFocusHighlightID > 0) { if (_keyboardFocusHighlightID > 0) {
getOverlays().deleteOverlay(_keyboardFocusHighlightID); getOverlays().deleteOverlay(_keyboardFocusHighlightID);
_keyboardFocusHighlightID = -1; _keyboardFocusHighlightID = -1;
@ -833,13 +841,6 @@ void Application::cleanupBeforeQuit() {
// destroy the AudioClient so it and its thread have a chance to go down safely // destroy the AudioClient so it and its thread have a chance to go down safely
DependencyManager::destroy<AudioClient>(); DependencyManager::destroy<AudioClient>();
#ifdef HAVE_DDE
DependencyManager::destroy<DdeFaceTracker>();
#endif
#ifdef HAVE_IVIEWHMD
DependencyManager::destroy<EyeTracker>();
#endif
} }
void Application::emptyLocalCache() { void Application::emptyLocalCache() {

View file

@ -254,9 +254,8 @@ void DdeFaceTracker::setEnabled(bool enabled) {
_ddeProcess = new QProcess(qApp); _ddeProcess = new QProcess(qApp);
connect(_ddeProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus))); connect(_ddeProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus)));
_ddeProcess->start(QCoreApplication::applicationDirPath() + DDE_PROGRAM_PATH, DDE_ARGUMENTS); _ddeProcess->start(QCoreApplication::applicationDirPath() + DDE_PROGRAM_PATH, DDE_ARGUMENTS);
} } else {
// Send a command to stop face tracker evening if no _ddeProcess in case DDE has been left running after a crash
if (!enabled && _ddeProcess) {
_ddeStopping = true; _ddeStopping = true;
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort); _udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
qCDebug(interfaceapp) << "DDE Face Tracker: Stopping"; qCDebug(interfaceapp) << "DDE Face Tracker: Stopping";