Skip to content

Commit

Permalink
fix: dde-file-manager crash
Browse files Browse the repository at this point in the history
Recent deconstruction, The RecentIterateWorker thread is still processing issues

Log: dde-file-manager crash
Bug: https://pms.uniontech.com/bug-view-257663.html
  • Loading branch information
liyigang1 committed Jul 2, 2024
1 parent b0125c3 commit c2e5e24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ void RecentIterateWorker::onRecentFileChanged(const QList<QUrl> &cachedUrls)
if (location.isEmpty())
continue;

if (stopped)

Check warning on line 51 in src/plugins/filemanager/core/dfmplugin-recent/files/recentiterateworker.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Condition 'stopped' is always false

Check warning on line 51 in src/plugins/filemanager/core/dfmplugin-recent/files/recentiterateworker.cpp

View workflow job for this annotation

GitHub Actions / static-check / Static-Check

Condition 'stopped' is always false
return;

const QUrl &url { QUrl(location) };
if (DeviceUtils::isLowSpeedDevice(url))
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@ RecentManager::RecentManager(QObject *parent)

RecentManager::~RecentManager()
{
if (watcher)
watcher->stopWatcher();
iteratorWorker->stop();
workerThread.quit();
workerThread.wait(15000);
}

void RecentManager::init()
Expand All @@ -194,6 +189,17 @@ void RecentManager::init()
&RecentManager::onUpdateRecentFileInfo);
connect(iteratorWorker, &RecentIterateWorker::deleteExistRecentUrls, this,
&RecentManager::onDeleteExistRecentUrls);
connect(qApp, &QApplication::aboutToQuit, this, [this](){
if (watcher) {
watcher->stopWatcher();
watcher->disconnect(this);
}
iteratorWorker->stop();
if (workerThread.isRunning()) {
workerThread.quit();
workerThread.wait();
}
});

workerThread.start();

Expand Down

0 comments on commit c2e5e24

Please sign in to comment.