Merge branch 'ukss-dev' into 'ukss-dev'

解决移除监听失败的问题。

See merge request kylin-desktop/ukui-search!359
This commit is contained in:
纪笑旭 2022-08-08 02:36:52 +00:00
commit 64eb691ca4
1 changed files with 5 additions and 4 deletions

View File

@ -104,15 +104,16 @@ QStringList FileSystemWatcherPrivate::removeWatch(const QString &path)
{ {
m_pool->waitForDone(); m_pool->waitForDone();
QStringList paths; QStringList paths;
for(QHash<int, QString>::Iterator i = m_watchPathHash.begin(); i != m_watchPathHash.end();) { for(int wd : m_watchPathHash.keys()) {
if(i.value().length() > path.length()) { QString tmpPath = m_watchPathHash.value(wd);
if(FileUtils::isOrUnder(i.value(), path)) { if(tmpPath.length() >= path.length()) {
if(FileUtils::isOrUnder(tmpPath, path)) {
//fix me:This function can be slow (O(n)) //fix me:This function can be slow (O(n))
paths.append(removeWatch(m_watchPathHash.key(path))); paths.append(removeWatch(m_watchPathHash.key(path)));
} }
} }
i++;
} }
return paths; return paths;
} }