From 9ebba84bfe65ecea5f25fc598e5bf2cd512f3332 Mon Sep 17 00:00:00 2001
From: Stian Sandvik Thomassen <stian.thomassen@nokia.com>
Date: Thu, 9 Jul 2009 14:51:56 +1000
Subject: [PATCH] Prevented project's existing .pro file from being added to
 project

A project's existing .pro file could be added to the project, making
the .pro file appear twice in the project tree. This is sub-optimal
because

1. It does not make sense for the .pro file to appear twice.
2. Qt Creator crashes when trying to remove either of the duplicate
.pro files.
---
 src/plugins/qt4projectmanager/qt4nodes.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp
index f8e2f6d4f75..f1556eb5ff0 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.cpp
+++ b/src/plugins/qt4projectmanager/qt4nodes.cpp
@@ -391,7 +391,10 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
         }
         const QModelIndex varIndex = root.child(row, 0);
 
+        const QString &proFilePath = includeFile->fileName();
         foreach (const QString &filePath, filePaths) {
+            if (filePath == proFilePath)
+                continue;
             const QString &relativeFilePath = priFileDir.relativeFilePath(filePath);
             proModel.insertItem(new ProValue(relativeFilePath, proVar),
                                 proModel.rowCount(varIndex), varIndex);
-- 
GitLab