diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 45a93bb7b..3443ebbfc 100755 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -2177,11 +2177,7 @@ void QBtSession::recursiveTorrentDownload(const QTorrentHandle &h) { } } -void QBtSession::cleanUpAutoRunProcess(int) { - sender()->deleteLater(); -} - -void QBtSession::autoRunExternalProgram(const QTorrentHandle &h, bool async) { +void QBtSession::autoRunExternalProgram(const QTorrentHandle &h) { if (!h.is_valid()) return; QString program = Preferences().getAutoRunProgram().trimmed(); if (program.isEmpty()) return; @@ -2194,14 +2190,7 @@ void QBtSession::autoRunExternalProgram(const QTorrentHandle &h, bool async) { program.replace("%f", torrent_path); // Replace %n by torrent name program.replace("%n", h.name()); - QProcess *process = new QProcess; - if (async) { - connect(process, SIGNAL(finished(int)), this, SLOT(cleanUpAutoRunProcess(int))); - process->start(program); - } else { - process->execute(program); - delete process; - } + QProcess::startDetached(program); } void QBtSession::sendNotificationEmail(const QTorrentHandle &h) { @@ -2294,7 +2283,7 @@ void QBtSession::readAlerts() { #endif // AutoRun program if (pref.isAutoRunEnabled()) - autoRunExternalProgram(h, will_shutdown); + autoRunExternalProgram(h); // Move .torrent file to another folder if (pref.isFinishedTorrentExportEnabled()) exportTorrentFile(h, FinishedTorrentExportFolder); diff --git a/src/qtlibtorrent/qbtsession.h b/src/qtlibtorrent/qbtsession.h index 1aa3f9656..95573f913 100755 --- a/src/qtlibtorrent/qbtsession.h +++ b/src/qtlibtorrent/qbtsession.h @@ -197,8 +197,7 @@ private slots: void exportTorrentFiles(QString path); void saveTempFastResumeData(); void sendNotificationEmail(const QTorrentHandle &h); - void autoRunExternalProgram(const QTorrentHandle &h, bool async=true); - void cleanUpAutoRunProcess(int); + void autoRunExternalProgram(const QTorrentHandle &h); void mergeTorrents(QTorrentHandle& h_ex, boost::intrusive_ptr t); void mergeTorrents(QTorrentHandle& h_ex, const QString& magnet_uri); void exportTorrentFile(const QTorrentHandle &h, TorrentExportFolder folder = RegularTorrentExportFolder);