forked from qt-creator/qt-creator
Fix hangs on trying to cdUp through not longer existing directories
This commit is contained in:
@@ -1226,21 +1226,30 @@ void CentralizedFolderWatcher::folderChanged(const QString &folder)
|
|||||||
qDebug()<<"CFW::folderChanged"<<folder;
|
qDebug()<<"CFW::folderChanged"<<folder;
|
||||||
// Figure out whom to inform
|
// Figure out whom to inform
|
||||||
|
|
||||||
QDir dir(folder);
|
qDebug()<<"start";
|
||||||
|
|
||||||
|
QString dir = folder;
|
||||||
while (true) {
|
while (true) {
|
||||||
QString path = dir.path();
|
if (!dir.endsWith('/'))
|
||||||
if (!path.endsWith('/'))
|
dir.append('/');
|
||||||
path.append('/');
|
QList<Qt4PriFileNode *> nodes = m_map.values(dir);
|
||||||
QList<Qt4PriFileNode *> nodes = m_map.values(path);
|
|
||||||
foreach (Qt4PriFileNode *node, nodes) {
|
foreach (Qt4PriFileNode *node, nodes) {
|
||||||
node->folderChanged(folder);
|
node->folderChanged(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir.isRoot())
|
// Chop off last part, and break if there's nothing to chop off
|
||||||
|
//
|
||||||
|
if (dir.length() < 2)
|
||||||
break;
|
break;
|
||||||
dir.cdUp();
|
|
||||||
|
// We start before the last slash
|
||||||
|
int index = dir.lastIndexOf('/', dir.length() - 2);
|
||||||
|
if (index == -1)
|
||||||
|
break;
|
||||||
|
dir = dir.left(index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString folderWithSlash = folder;
|
QString folderWithSlash = folder;
|
||||||
if (!folder.endsWith('/'))
|
if (!folder.endsWith('/'))
|
||||||
folderWithSlash.append('/');
|
folderWithSlash.append('/');
|
||||||
|
Reference in New Issue
Block a user