Hi,
today I tried to run my sender process with QProcess::startDetached() and it worked without any problems.
Starting the same sender process as a normal QProcess with the start method results in a segmentation fault after receiving a few packets.
I post the corresponding code, maybe somebody got an idea what I am doing wrong. I am not sure if it makes any difference, but I am running that program under Linux.
Line 49 is the one that works if I comment out line 48 instead.
Any comments are appreciated! Thanks in advance!
P.S.: I am quiet sure that line 46 is not necessay but as I am running out of ideas I also tried this.
@
void ReceiverGui::startReceiver() {
if (!settingsOk()) {
return;
}
toogleStartStopButton();
//! Start network
setupAndStartNetwork();
//! Determine receiver executable and working directory
QString receiverFilePath = this->settings->value("receiverLocation").toString();
QString receiverWorkingDirectory;
QStringList receiverPathParts = receiverFilePath.split("/");
for (int i = 0; i < receiverPathParts.size()-1; i++) {
receiverWorkingDirectory.append(receiverPathParts.at(i));
receiverWorkingDirectory.append("/");
}
QString receiverExecutableFile = "./" + receiverPathParts.at(receiverPathParts.size()-1);
QStringList arguments;
//! Start the receiver
if (this->ui.settingsTabWidget->getLastSelectedMode() == SettingsTabWidget::EXTERNAL
|| this->ui.settingsTabWidget->getLastSelectedMode() == SettingsTabWidget::FILE)
{
//! determine file to decode
QString inputFilePath;
if (this->ui.settingsTabWidget->getLastSelectedMode() == SettingsTabWidget::EXTERNAL) {
inputFilePath = this->ui.settingsTabWidget->getInputFileNonEvaluationPath();
}
else if(this->ui.settingsTabWidget->getLastSelectedMode() == SettingsTabWidget::FILE) {
inputFilePath = this->ui.settingsTabWidget->getInputFileEvaluationPath();
}
inputFilePath = inputFilePath.left(inputFilePath.size()-6);
arguments << inputFilePath;
// determine plp number
int plpNumber = this->ui.settingsTabWidget->getPlpNumber();
arguments << QString::number(plpNumber);
// determine xml config file
QString configFilePath = this->settings->value("receiverConfigLocation").toString();
arguments << configFilePath;
//! start the process
receiverProcess->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
receiverProcess->setWorkingDirectory(receiverWorkingDirectory);
receiverProcess->start(receiverExecutableFile, arguments, QIODevice::ReadOnly);
// QProcess::startDetached(receiverExecutableFile, arguments, receiverWorkingDirectory); //! works
}
else if (this->ui.settingsTabWidget->getLastSelectedMode() == SettingsTabWidget::REAL_TIME) {
// ...
}
}
@