Skip to content

Commit

Permalink
fix: Switching directory lag,add stop check in file info creation loop
Browse files Browse the repository at this point in the history
Add a stop condition check in TraversalDirThreadManager::createFileInfo to
properly handle interruption requests during file info creation process.

- Add stopFlag check in the file info creation loop
- Early return when stopFlag is set to prevent unnecessary operations
- Improve responsiveness when canceling directory traversal

This change ensures the traversal operation can be stopped promptly when
requested by the user or system.

Log: Switching directory lag
Bug: https://bbs.deepin.org/post/281034
  • Loading branch information
liyigang1 authored and deepin-bot[bot] committed Nov 13, 2024
1 parent 9dc8294 commit 4978779
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ QList<SortInfoPointer> TraversalDirThreadManager::iteratorAll()
void TraversalDirThreadManager::createFileInfo(const QList<SortInfoPointer> &list)
{
for (const SortInfoPointer &sortInfo : list) {
if (stopFlag)
return;
const QUrl &url = sortInfo->fileUrl();
InfoFactory::create<FileInfo>(url);
}
Expand Down

0 comments on commit 4978779

Please sign in to comment.