mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-09 02:59:48 +02:00
Merge pull request #5776 from birarda/ac-pid-zero
make sure AC process ID is valid before acting on the process
This commit is contained in:
commit
0e63147be2
1 changed files with 16 additions and 10 deletions
|
@ -94,18 +94,22 @@ void AssignmentClientMonitor::stopChildProcesses() {
|
||||||
|
|
||||||
// ask child processes to terminate
|
// ask child processes to terminate
|
||||||
foreach(QProcess* childProcess, _childProcesses) {
|
foreach(QProcess* childProcess, _childProcesses) {
|
||||||
|
if (childProcess->processId() > 0) {
|
||||||
qDebug() << "Attempting to terminate child process" << childProcess->processId();
|
qDebug() << "Attempting to terminate child process" << childProcess->processId();
|
||||||
childProcess->terminate();
|
childProcess->terminate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
simultaneousWaitOnChildren(WAIT_FOR_CHILD_MSECS);
|
simultaneousWaitOnChildren(WAIT_FOR_CHILD_MSECS);
|
||||||
|
|
||||||
if (_childProcesses.size() > 0) {
|
if (_childProcesses.size() > 0) {
|
||||||
// ask even more firmly
|
// ask even more firmly
|
||||||
foreach(QProcess* childProcess, _childProcesses) {
|
foreach(QProcess* childProcess, _childProcesses) {
|
||||||
|
if (childProcess->processId() > 0) {
|
||||||
qDebug() << "Attempting to kill child process" << childProcess->processId();
|
qDebug() << "Attempting to kill child process" << childProcess->processId();
|
||||||
childProcess->kill();
|
childProcess->kill();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
simultaneousWaitOnChildren(WAIT_FOR_CHILD_MSECS);
|
simultaneousWaitOnChildren(WAIT_FOR_CHILD_MSECS);
|
||||||
}
|
}
|
||||||
|
@ -155,12 +159,14 @@ void AssignmentClientMonitor::spawnChildClient() {
|
||||||
|
|
||||||
assignmentClient->start(QCoreApplication::applicationFilePath(), _childArguments);
|
assignmentClient->start(QCoreApplication::applicationFilePath(), _childArguments);
|
||||||
|
|
||||||
|
if (assignmentClient->processId() > 0) {
|
||||||
// make sure we hear that this process has finished when it does
|
// make sure we hear that this process has finished when it does
|
||||||
connect(assignmentClient, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(childProcessFinished()));
|
connect(assignmentClient, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(childProcessFinished()));
|
||||||
|
|
||||||
qDebug() << "Spawned a child client with PID" << assignmentClient->pid();
|
qDebug() << "Spawned a child client with PID" << assignmentClient->processId();
|
||||||
_childProcesses.insert(assignmentClient->processId(), assignmentClient);
|
_childProcesses.insert(assignmentClient->processId(), assignmentClient);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AssignmentClientMonitor::checkSpares() {
|
void AssignmentClientMonitor::checkSpares() {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
Loading…
Reference in a new issue