From 51d2c831b90a97ce0ea964664a3ac4280538991a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Thu, 20 Aug 2009 19:38:43 +0200 Subject: [PATCH] Fix crash in include completion with non-canonical include paths Use QFileInfo::fileName() to get the filename, since that also works when the original path wasn't canonical. --- src/plugins/cpptools/cppmodelmanager.cpp | 6 +----- src/plugins/cpptools/cppmodelmanagerinterface.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 2c7d0f8f5a6..6b6c2bbf956 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -1119,11 +1119,7 @@ void CppModelManager::updateIncludesInPaths(QFutureInterface &future, const QFileInfo fileInfo = i.fileInfo(); const QString suffix = fileInfo.suffix(); if (suffix.isEmpty() || suffixes.contains(suffix)) { - QString text = fileName.mid(path.length() + 1); - if (text.isEmpty()) { - qWarning() << Q_FUNC_INFO << "Empty filename?" << path << fileName; - continue; - } + QString text = fileInfo.fileName(); if (fileInfo.isDir()) { text += QLatin1Char('/'); diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index ecea41dc2cb..996b9b6621d 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -41,7 +41,7 @@ namespace ProjectExplorer { } namespace CppTools { - + class AbstractEditorSupport; class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject