From 65ff19e7fa8a00c8f6bd9f9ee2bd21e5096f15ad Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Mon, 23 Feb 2009 17:49:03 +0100
Subject: [PATCH] Postpone the update of the ifdefedOut blocks.

---
 src/plugins/cpptools/cppmodelmanager.cpp | 4 +++-
 src/plugins/cpptools/cppmodelmanager.h   | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index aeba818cbf3..c7cda11081e 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -760,7 +760,6 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc)
             foreach (const Document::Block &block, doc->skippedBlocks()) {
                 blockRanges.append(TextEditor::BaseTextEditor::BlockRange(block.begin(), block.end()));
             }
-            ed->setIfdefedOutBlocks(blockRanges);
 
             QList<QTextEdit::ExtraSelection> selections;
 
@@ -827,6 +826,7 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc)
             Editor e;
             e.widget = ed;
             e.selections = selections;
+            e.ifdefedOutBlocks = blockRanges;
             todo.append(e);
             m_todo = todo;
             postEditorUpdate();
@@ -848,6 +848,8 @@ void CppModelManager::updateEditorSelections()
 
         ed.widget->setExtraSelections(TextEditor::BaseTextEditor::CodeWarningsSelection,
                                       ed.selections);
+
+        ed.widget->setIfdefedOutBlocks(ed.ifdefedOutBlocks);
     }
 
     m_todo.clear();
diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h
index fb645ffe8f3..58c3e81f633 100644
--- a/src/plugins/cpptools/cppmodelmanager.h
+++ b/src/plugins/cpptools/cppmodelmanager.h
@@ -38,6 +38,8 @@
 #include <projectexplorer/project.h>
 #include <cplusplus/CppDocument.h>
 
+#include <texteditor/basetexteditor.h>
+
 #include <QMap>
 #include <QFutureInterface>
 #include <QMutex>
@@ -171,6 +173,7 @@ private:
     struct Editor {
         QPointer<TextEditor::BaseTextEditor> widget;
         QList<QTextEdit::ExtraSelection> selections;
+        QList<TextEditor::BaseTextEditor::BlockRange> ifdefedOutBlocks;
     };
 
     QList<Editor> m_todo;
-- 
GitLab