From 22130aae2718743c9558b519f6fd44c17cf71a08 Mon Sep 17 00:00:00 2001
From: Christian Kamm <christian.d.kamm@nokia.com>
Date: Mon, 11 Oct 2010 14:45:58 +0200
Subject: [PATCH] C++ editor: Fix performance problem when using the mouse to
 find links.

It is unnecessary to try hard to resolve a class forward declaration
when all you want to know is whether it is a valid link or not.

Task-number: QTCREATORBUG-2688
Reviewed-by: Thorbjorn Lindeijer
---
 src/plugins/cppeditor/cppeditor.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index e106306e0af..e30bdbc5d14 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -1313,10 +1313,10 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
 
                 if (def == lastVisibleSymbol)
                     def = 0; // jump to declaration then.
-            }
 
-            if (symbol->isForwardClassDeclaration()) {
-                def = snapshot.findMatchingClassDeclaration(symbol);
+                if (symbol->isForwardClassDeclaration()) {
+                    def = snapshot.findMatchingClassDeclaration(symbol);
+                }
             }
 
             link = linkToSymbol(def ? def : symbol);
-- 
GitLab