Commit c866108c authored by Elvis Angelaccio's avatar Elvis Angelaccio

Fix potential crash when aborting a ListJob

Libarchive's error() signal is connected to the `Job::onError` slot, but
when we abort a ListJob, the slot might be called when the job instance
has already been deleted. So we now emit this signal only when we are not
aborting the job.

BUG: 369283
FIXED-IN: 16.08.2

Differential Revision: D2852
parent e306625c
......@@ -104,12 +104,13 @@ bool LibarchivePlugin::list()
m_cachedArchiveEntryCount++;
archive_read_data_skip(arch_reader.data());
}
m_abortOperation = false;
if (result != ARCHIVE_EOF) {
const QString errorString = QLatin1String(archive_error_string(arch_reader.data()));
// FIXME: what about the other archive_error_string() calls? Do they also happen to return empty strings?
emit error(errorString.isEmpty() ? i18nc("@info", "Could not read until the end of the archive") : errorString);
if (!m_abortOperation) {
const QString errorString = QLatin1String(archive_error_string(arch_reader.data()));
// FIXME: what about the other archive_error_string() calls? Do they also happen to return empty strings?
emit error(errorString.isEmpty() ? i18nc("@info", "Could not read until the end of the archive") : errorString);
}
return false;
}
......
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