Commit cee79c34 authored by Tom Moebert's avatar Tom Moebert Committed by Elvis Angelaccio
Browse files

Fix an endless recursion when unpacking archives

Previously, if a process keeps spamming output on stdout, ark would
continue to react on this output, even though it was about to kill that
process. This may end in an endless recursion.

CCBUG: 426051
parent 5f569f05
......@@ -285,7 +285,7 @@ bool CliInterface::runProcess(const QString& programName, const QStringList& arg
m_process->setNextOpenMode(QIODevice::ReadWrite | QIODevice::Unbuffered | QIODevice::Text);
m_process->setProgram(programPath, arguments);
connect(m_process, &QProcess::readyReadStandardOutput, this, [=]() {
m_readyStdOutConnection = connect(m_process, &QProcess::readyReadStandardOutput, this, [=]() {
readStdout();
});
......@@ -703,6 +703,10 @@ void CliInterface::killProcess(bool emitFinished)
return;
}
// waitForFinished() will enter QT's event loop. Disconnect the readyReadStandardOutput
// signal, to avoid an endless recursion, if the process keeps spamming output on stdout.
disconnect(m_readyStdOutConnection);
m_abortingOperation = !emitFinished;
// Give some time for the application to finish gracefully
......
......@@ -226,6 +226,8 @@ private:
qulonglong m_archiveSizeOnDisk = 0;
qulonglong m_listedSize = 0;
QMetaObject::Connection m_readyStdOutConnection;
protected Q_SLOTS:
virtual void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment