Commit 23424950 authored by Elvis Angelaccio's avatar Elvis Angelaccio
Browse files

Fix endless loop of ListJobs

There is a race condition when ListJob emits the result signal.
Both ArchiveModel::slotLoadingFinished() and Archive::onListFinished() are connected
to this signal. But the former triggers a chain of calls that ends up calling
properties of Archive that are set by the concurrent Archive::onListFinished().
An example is Archive::encryptionType() called by Part::updateActions().

This results in an endless chain of ListJob instances.

This patch is only a temporary workaround for the upcoming 16.08 stable
release, since there is no time to test and merge a proper fix (see T3300)

Differential Revision: D2272
Task: T3296
parent 28a5faea
......@@ -466,6 +466,7 @@ void Archive::onListFinished(KJob* job)
m_hasBeenListed = true;
emit loadingFinished();
void Archive::listIfNotListed()
......@@ -506,4 +507,9 @@ QString Archive::multiVolumeName() const
return m_iface->multiVolumeName();
bool Archive::hasBeenListed() const
return m_hasBeenListed;
} // namespace Kerfuffle
......@@ -190,6 +190,8 @@ public:
void setCompressionOptions(const CompressionOptions &opts);
CompressionOptions compressionOptions() const;
QString multiVolumeName() const;
// FIXME: this is only a temporary workaround. See T3300 for a proper fix.
bool hasBeenListed() const;
static Archive *create(const QString &fileName, QObject *parent = 0);
static Archive *create(const QString &fileName, const QString &fixedMimeType, QObject *parent = 0);
......@@ -244,6 +246,9 @@ public:
void encrypt(const QString &password, bool encryptHeader);
void loadingFinished();
private slots:
void onListFinished(KJob*);
void onAddFinished(KJob*);
......@@ -419,6 +419,7 @@ void Part::updateActions()
// archives). If we added files they would not get encrypted resulting in an
// archive with a mixture of encrypted and unencrypted files.
const bool isEncryptedButUnknownPassword = m_model->archive() &&
m_model->archive()->hasBeenListed() &&
m_model->archive()->encryptionType() != Archive::Unencrypted &&
......@@ -671,6 +672,7 @@ bool Part::openFile()
// Plugin loaded successfully.
KJob *job = m_model->setArchive(archive.take());
if (job) {
connect(, &Archive::loadingFinished, this, &Part::updateActions);
} else {
Supports Markdown
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