forked from qt-creator/qt-creator
VCS: Fix crash in VCSManager
This commit is contained in:
@@ -127,7 +127,7 @@ public:
|
|||||||
m_vcsInfoList.append(newInfo);
|
m_vcsInfoList.append(newInfo);
|
||||||
|
|
||||||
QString tmpDir = directory;
|
QString tmpDir = directory;
|
||||||
while (tmpDir.count() >= topLevel.count()) {
|
while (tmpDir.count() >= topLevel.count() && tmpDir.count() > 0) {
|
||||||
m_cachedMatches.insert(tmpDir, newInfo);
|
m_cachedMatches.insert(tmpDir, newInfo);
|
||||||
int slashPos = tmpDir.lastIndexOf(SLASH);
|
int slashPos = tmpDir.lastIndexOf(SLASH);
|
||||||
tmpDir = slashPos >= 0 ? tmpDir.left(tmpDir.lastIndexOf(SLASH)) : QString();
|
tmpDir = slashPos >= 0 ? tmpDir.left(tmpDir.lastIndexOf(SLASH)) : QString();
|
||||||
@@ -174,7 +174,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &direc
|
|||||||
if (directory.isEmpty())
|
if (directory.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
VcsManagerPrivate::VcsInfo * cachedData = m_d->findUpInCache(directory);
|
VcsManagerPrivate::VcsInfo *cachedData = m_d->findInCache(directory);
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
if (topLevelDirectory)
|
if (topLevelDirectory)
|
||||||
*topLevelDirectory = cachedData->topLevel;
|
*topLevelDirectory = cachedData->topLevel;
|
||||||
@@ -186,7 +186,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &direc
|
|||||||
QList<QPair<QString, IVersionControl *> > allThatCanManage;
|
QList<QPair<QString, IVersionControl *> > allThatCanManage;
|
||||||
|
|
||||||
foreach (IVersionControl * versionControl, versionControls) {
|
foreach (IVersionControl * versionControl, versionControls) {
|
||||||
QString topLevel = cachedData ? cachedData->topLevel : QString();
|
QString topLevel;
|
||||||
if (versionControl->managesDirectory(directory, &topLevel))
|
if (versionControl->managesDirectory(directory, &topLevel))
|
||||||
allThatCanManage.push_back(qMakePair(topLevel, versionControl));
|
allThatCanManage.push_back(qMakePair(topLevel, versionControl));
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &direc
|
|||||||
qSort(allThatCanManage.begin(), allThatCanManage.end(), longerThanPath);
|
qSort(allThatCanManage.begin(), allThatCanManage.end(), longerThanPath);
|
||||||
|
|
||||||
if (allThatCanManage.isEmpty()) {
|
if (allThatCanManage.isEmpty()) {
|
||||||
m_d->cache(0, cachedData->topLevel, directory); // register that nothing was found!
|
m_d->cache(0, QString(), directory); // register that nothing was found!
|
||||||
|
|
||||||
// report result;
|
// report result;
|
||||||
if (topLevelDirectory)
|
if (topLevelDirectory)
|
||||||
|
Reference in New Issue
Block a user