mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-05 16:19:10 +00:00
Do not cache indexes across async tasks
Capturing an index is unsafe as it could be out of date when this is processed. The user could have changed directory inserted a file or changed sorting order.
This commit is contained in:
parent
35235589aa
commit
30691235c5
|
@ -1315,7 +1315,11 @@ void KFileItemModelRolesUpdater::startDirectorySizeCounting(const KFileItem &ite
|
||||||
connect(m_model, &KFileItemModel::itemsChanged, this, &KFileItemModelRolesUpdater::slotItemsChanged);
|
connect(m_model, &KFileItemModel::itemsChanged, this, &KFileItemModelRolesUpdater::slotItemsChanged);
|
||||||
|
|
||||||
auto listJob = KIO::listDir(url, KIO::HideProgressInfo);
|
auto listJob = KIO::listDir(url, KIO::HideProgressInfo);
|
||||||
QObject::connect(listJob, &KIO::ListJob::entries, this, [this, index](const KJob * /*job*/, const KIO::UDSEntryList &list) {
|
QObject::connect(listJob, &KIO::ListJob::entries, this, [this, item](const KJob * /*job*/, const KIO::UDSEntryList &list) {
|
||||||
|
int index = m_model->index(item);
|
||||||
|
if (index < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto data = m_model->data(index);
|
auto data = m_model->data(index);
|
||||||
int origCount = data.value("count").toInt();
|
int origCount = data.value("count").toInt();
|
||||||
int entryCount = origCount;
|
int entryCount = origCount;
|
||||||
|
|
Loading…
Reference in a new issue