diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-22 21:48:52 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-22 21:48:52 +1000 |
| commit | 1991b4176c302ac30ea3a1539d139eaee574b0a5 (patch) | |
| tree | b833c3f6f776efc0196816a1f93d4b452909ac2d /plugin/src/Caelestia/Models | |
| parent | plugin/fsm: dont store comparator (diff) | |
| download | caelestia-shell-1991b4176c302ac30ea3a1539d139eaee574b0a5.tar.gz caelestia-shell-1991b4176c302ac30ea3a1539d139eaee574b0a5.tar.bz2 caelestia-shell-1991b4176c302ac30ea3a1539d139eaee574b0a5.zip | |
plugin: delete entries after emitting signal
Diffstat (limited to 'plugin/src/Caelestia/Models')
| -rw-r--r-- | plugin/src/Caelestia/Models/filesystemmodel.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugin/src/Caelestia/Models/filesystemmodel.cpp b/plugin/src/Caelestia/Models/filesystemmodel.cpp index feddea4..78a6df1 100644 --- a/plugin/src/Caelestia/Models/filesystemmodel.cpp +++ b/plugin/src/Caelestia/Models/filesystemmodel.cpp @@ -380,6 +380,8 @@ void FileSystemModel::applyChanges(const QSet<QString>& removedPaths, const QSet } std::sort(removedIndices.begin(), removedIndices.end(), std::greater<int>()); + QList<FileSystemEntry*> toDelete; + int start = -1; int end = -1; for (int idx : removedIndices) { @@ -392,7 +394,7 @@ void FileSystemModel::applyChanges(const QSet<QString>& removedPaths, const QSet beginRemoveRows(QModelIndex(), end, start); for (int i = start; i >= end; --i) { emit removed(m_entries[i]->path()); - m_entries.takeAt(i)->deleteLater(); + toDelete << m_entries.takeAt(i); } endRemoveRows(); @@ -404,7 +406,7 @@ void FileSystemModel::applyChanges(const QSet<QString>& removedPaths, const QSet beginRemoveRows(QModelIndex(), end, start); for (int i = start; i >= end; --i) { emit removed(m_entries[i]->path()); - m_entries.takeAt(i)->deleteLater(); + toDelete << m_entries.takeAt(i); } endRemoveRows(); } @@ -460,6 +462,7 @@ void FileSystemModel::applyChanges(const QSet<QString>& removedPaths, const QSet } emit entriesChanged(); + qDeleteAll(toDelete); } bool FileSystemModel::compareEntries(const FileSystemEntry* a, const FileSystemEntry* b) const { |