Skip to content

Commit

Permalink
Merge pull request #299 from iDarkTemplar/qprocess_leak
Browse files Browse the repository at this point in the history
Remove unneeded QProcess instances
  • Loading branch information
andrew-bibb authored Oct 11, 2023
2 parents 8eaa48c + e44b657 commit 65c1376
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
9 changes: 3 additions & 6 deletions apps/cmstapp/code/agent/agent_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,6 @@ void AgentDialog::enteringBrowser()
// Called when ui.pushButton_launch_browser is pressed
void AgentDialog::launchBrowser()
{
// variables
QProcess* process = new QProcess(this);

// find installed terminals that we can deal with
QStringList sl_terminals = QStringList();
if (! sys_env_path.isEmpty() ) {
Expand All @@ -287,11 +284,11 @@ void AgentDialog::launchBrowser()
QStringList sl_args = QStringList();
if (sl_terminals.contains("roxterm")) {
sl_args << "-T" << "Web Login" << "--execute" << chosenBrowser << ui.lineEdit_url->text();
process->startDetached(QString("roxterm"), sl_args);
QProcess::startDetached(QString("roxterm"), sl_args);
}
else if (sl_terminals.contains("xterm")) {
sl_args << "-T" << "Web Login" << "-e" << chosenBrowser << ui.lineEdit_url->text();
process->startDetached(QString("xterm"), sl_args);
QProcess::startDetached(QString("xterm"), sl_args);
}
else
QMessageBox::information(qobject_cast<QWidget *> (parent()),
Expand All @@ -300,7 +297,7 @@ void AgentDialog::launchBrowser()
"Currenty we can start %1 using these terminals: <b>roxterm</b> and <b>xterm</b>." \
"<br><br>To continue you need to manually open a terminal and then enter: \"%1 %2\"").arg(chosenBrowser).arg(ui.lineEdit_url->text()) );
} else {
process->startDetached(chosenBrowser, QStringList(ui.lineEdit_url->text()) );
QProcess::startDetached(chosenBrowser, QStringList(ui.lineEdit_url->text()) );
}

return;
Expand Down
3 changes: 1 addition & 2 deletions apps/cmstapp/code/control_box/controlbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,8 +1157,7 @@ void ControlBox::dbsPropertyChanged(QString prop, QDBusVariant dbvalue)
QStringList args = text.split(' ');
QString cmd = args.first();
args.removeFirst();
QProcess* proc = new QProcess(this);
proc->startDetached(cmd, args);
QProcess::startDetached(cmd, args);
} // if online or ready and not online before
} // if lineedit not empty

Expand Down

0 comments on commit 65c1376

Please sign in to comment.