From 0faa5d69953f41deafba33cf36317127cbea8a8a Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 06:58:21 -0400 Subject: fixed crashes and empty items in the file tree sorting and removing items have to be queued since they corrupt various internal structures in Qt when done during layout --- src/filetreemodel.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/filetreemodel.h') diff --git a/src/filetreemodel.h b/src/filetreemodel.h index 5bfb75aa..8d3af5f7 100644 --- a/src/filetreemodel.h +++ b/src/filetreemodel.h @@ -93,6 +93,13 @@ private: SortInfo m_sort; bool m_fullyLoaded; + // see top of filetreemodel.cpp + std::vector m_removeItems; + QTimer m_removeTimer; + std::vector m_sortItems; + QTimer m_sortTimer; + + bool showConflictsOnly() const { return (m_flags & ConflictsOnly); @@ -101,18 +108,28 @@ private: bool showArchives() const; + // for `forFetching`, see top of filetreemodel.cpp void update( FileTreeItem& parentItem, const MOShared::DirectoryEntry& parentEntry, - const std::wstring& parentPath); + const std::wstring& parentPath, bool forFetching); + + void queueRemoveItem(FileTreeItem* item); + void removeItems(); + void queueSortItem(FileTreeItem* item); + void sortItems(); + + // for `forFetching`, see top of filetreemodel.cpp bool updateDirectories( FileTreeItem& parentItem, const std::wstring& path, - const MOShared::DirectoryEntry& parentEntry); + const MOShared::DirectoryEntry& parentEntry, bool forFetching); + // for `forFetching`, see top of filetreemodel.cpp void removeDisappearingDirectories( FileTreeItem& parentItem, const MOShared::DirectoryEntry& parentEntry, - const std::wstring& parentPath, std::unordered_set& seen); + const std::wstring& parentPath, std::unordered_set& seen, + bool forFetching); bool addNewDirectories( FileTreeItem& parentItem, const MOShared::DirectoryEntry& parentEntry, -- cgit v1.3.1