mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-08 22:28:20 +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,8 +94,10 @@ void AssignmentClientMonitor::stopChildProcesses() {
|
||||||
|
|
||||||
// ask child processes to terminate
|
// ask child processes to terminate
|
||||||
foreach(QProcess* childProcess, _childProcesses) {
|
foreach(QProcess* childProcess, _childProcesses) {
|
||||||
qDebug() << "Attempting to terminate child process" << childProcess->processId();
|
if (childProcess->processId() > 0) {
|
||||||
childProcess->terminate();
|
qDebug() << "Attempting to terminate child process" << childProcess->processId();
|
||||||
|
childProcess->terminate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
simultaneousWaitOnChildren(WAIT_FOR_CHILD_MSECS);
|
simultaneousWaitOnChildren(WAIT_FOR_CHILD_MSECS);
|
||||||
|
@ -103,8 +105,10 @@ void AssignmentClientMonitor::stopChildProcesses() {
|
||||||
if (_childProcesses.size() > 0) {
|
if (_childProcesses.size() > 0) {
|
||||||
// ask even more firmly
|
// ask even more firmly
|
||||||
foreach(QProcess* childProcess, _childProcesses) {
|
foreach(QProcess* childProcess, _childProcesses) {
|
||||||
qDebug() << "Attempting to kill child process" << childProcess->processId();
|
if (childProcess->processId() > 0) {
|
||||||
childProcess->kill();
|
qDebug() << "Attempting to kill child process" << childProcess->processId();
|
||||||
|
childProcess->kill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
simultaneousWaitOnChildren(WAIT_FOR_CHILD_MSECS);
|
simultaneousWaitOnChildren(WAIT_FOR_CHILD_MSECS);
|
||||||
|
@ -154,12 +158,14 @@ void AssignmentClientMonitor::spawnChildClient() {
|
||||||
assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels);
|
assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels);
|
||||||
|
|
||||||
assignmentClient->start(QCoreApplication::applicationFilePath(), _childArguments);
|
assignmentClient->start(QCoreApplication::applicationFilePath(), _childArguments);
|
||||||
|
|
||||||
// make sure we hear that this process has finished when it does
|
if (assignmentClient->processId() > 0) {
|
||||||
connect(assignmentClient, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(childProcessFinished()));
|
// make sure we hear that this process has finished when it does
|
||||||
|
connect(assignmentClient, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(childProcessFinished()));
|
||||||
qDebug() << "Spawned a child client with PID" << assignmentClient->pid();
|
|
||||||
_childProcesses.insert(assignmentClient->processId(), assignmentClient);
|
qDebug() << "Spawned a child client with PID" << assignmentClient->processId();
|
||||||
|
_childProcesses.insert(assignmentClient->processId(), assignmentClient);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssignmentClientMonitor::checkSpares() {
|
void AssignmentClientMonitor::checkSpares() {
|
||||||
|
|
Loading…
Reference in a new issue