mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:16:51 +02:00
Fix DDE shutdown
This commit is contained in:
parent
736691e3ec
commit
c37eb3de8a
2 changed files with 13 additions and 6 deletions
|
@ -144,6 +144,7 @@ DdeFaceTracker::DdeFaceTracker() :
|
||||||
|
|
||||||
DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, quint16 controlPort) :
|
DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, quint16 controlPort) :
|
||||||
_ddeProcess(NULL),
|
_ddeProcess(NULL),
|
||||||
|
_ddeStopping(false),
|
||||||
_host(host),
|
_host(host),
|
||||||
_serverPort(serverPort),
|
_serverPort(serverPort),
|
||||||
_controlPort(controlPort),
|
_controlPort(controlPort),
|
||||||
|
@ -196,6 +197,7 @@ void DdeFaceTracker::setEnabled(bool enabled) {
|
||||||
if (enabled && !_ddeProcess) {
|
if (enabled && !_ddeProcess) {
|
||||||
// Terminate any existing DDE process, perhaps left running after an Interface crash
|
// Terminate any existing DDE process, perhaps left running after an Interface crash
|
||||||
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
|
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
|
||||||
|
_ddeStopping = false;
|
||||||
|
|
||||||
qDebug() << "[Info] DDE Face Tracker Starting";
|
qDebug() << "[Info] DDE Face Tracker Starting";
|
||||||
_ddeProcess = new QProcess(qApp);
|
_ddeProcess = new QProcess(qApp);
|
||||||
|
@ -204,9 +206,8 @@ void DdeFaceTracker::setEnabled(bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enabled && _ddeProcess) {
|
if (!enabled && _ddeProcess) {
|
||||||
|
_ddeStopping = true;
|
||||||
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
|
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
|
||||||
delete _ddeProcess;
|
|
||||||
_ddeProcess = NULL;
|
|
||||||
qDebug() << "[Info] DDE Face Tracker Stopped";
|
qDebug() << "[Info] DDE Face Tracker Stopped";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -214,11 +215,16 @@ void DdeFaceTracker::setEnabled(bool enabled) {
|
||||||
|
|
||||||
void DdeFaceTracker::processFinished(int exitCode, QProcess::ExitStatus exitStatus) {
|
void DdeFaceTracker::processFinished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||||
if (_ddeProcess) {
|
if (_ddeProcess) {
|
||||||
// DDE crashed or was manually terminated
|
if (_ddeStopping) {
|
||||||
qDebug() << "[Info] DDE Face Tracker Stopped Unexpectedly";
|
qCDebug(interfaceapp) << "DDE Face Tracker: Stopped";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
qCWarning(interfaceapp) << "DDE Face Tracker: Stopped unexpectedly";
|
||||||
|
Menu::getInstance()->setIsOptionChecked(MenuOption::NoFaceTracking, true);
|
||||||
|
}
|
||||||
_udpSocket.close();
|
_udpSocket.close();
|
||||||
|
delete _ddeProcess;
|
||||||
_ddeProcess = NULL;
|
_ddeProcess = NULL;
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::NoFaceTracking, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,10 @@ private slots:
|
||||||
private:
|
private:
|
||||||
DdeFaceTracker();
|
DdeFaceTracker();
|
||||||
DdeFaceTracker(const QHostAddress& host, quint16 serverPort, quint16 controlPort);
|
DdeFaceTracker(const QHostAddress& host, quint16 serverPort, quint16 controlPort);
|
||||||
~DdeFaceTracker();
|
virtual ~DdeFaceTracker();
|
||||||
|
|
||||||
QProcess* _ddeProcess;
|
QProcess* _ddeProcess;
|
||||||
|
bool _ddeStopping;
|
||||||
|
|
||||||
QHostAddress _host;
|
QHostAddress _host;
|
||||||
quint16 _serverPort;
|
quint16 _serverPort;
|
||||||
|
|
Loading…
Reference in a new issue