musredit_qt5: replaced QProcess::startDetached by QProcess::start for musrT0 and musrFT due to issues with macOS 10.12. I will need to investigate the ownership issue a bit more careful since this fix might lead to a memory leak.

This commit is contained in:
suter_a 2016-11-15 14:46:11 +01:00
parent 19d5c09b45
commit 87c8860ef7

View File

@ -2259,9 +2259,22 @@ void PTextEdit::musrT0()
str.setNum(fAdmin->getTimeout());
arg << "--timeout" << str;
QProcess proc(this);
if (!proc.startDetached(cmd, arg, workDir)) {
QMessageBox::critical(this, "ERROR", "**ERROR** musrt0 process couldn't be launched properly, sorry.");
QProcess *proc = new QProcess(this);
// make sure that the system environment variables are properly set
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" + env.value("LD_LIBRARY_PATH"));
proc->setProcessEnvironment(env);
proc->setWorkingDirectory(workDir);
proc->start(cmd, arg);
if (!proc->waitForStarted()) {
// error handling
QString msg(tr("Could not execute the output command: ")+cmd[0]);
QMessageBox::critical( 0,
tr("Fatal error"),
msg,
tr("Quit") );
return;
}
}
@ -2282,11 +2295,23 @@ void PTextEdit::musrFT()
if (dlg->exec() == QDialog::Accepted) {
fMusrFTPrevCmd = dlg->getMusrFTOptions();
QProcess proc(this);
proc.setStandardOutputFile("musrFT.log");
proc.setStandardErrorFile("musrFT.log");
QProcess *proc = new QProcess(this);
proc->setStandardOutputFile("musrFT.log");
proc->setStandardErrorFile("musrFT.log");
QString cmd = fAdmin->getExecPath() + "/musrFT";
proc.startDetached(cmd, fMusrFTPrevCmd);
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" + env.value("LD_LIBRARY_PATH"));
proc->setProcessEnvironment(env);
proc->start(cmd, fMusrFTPrevCmd);
if (!proc->waitForStarted()) {
// error handling
QString msg(tr("Could not execute the output command: ")+cmd[0]);
QMessageBox::critical( 0,
tr("Fatal error"),
msg,
tr("Quit") );
return;
}
}
delete dlg;