mirror of
https://invent.kde.org/system/dolphin
synced 2024-07-04 17:30:55 +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);
|
||||
|
||||
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);
|
||||
int origCount = data.value("count").toInt();
|
||||
int entryCount = origCount;
|
||||
|
|
Loading…
Reference in New Issue
Block a user