CppTools: Fix race conditions in CppEditorSupport

...when accessing m_lastSemanticInfo by introducing semanticInfo() and
setSemanticInfo(), which lock the appropriate mutex.

Task-number: QTCREATORBUG-11367
Change-Id: If8ac6b8e6d576dfd1869c98a7ff7952ec97f530e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Nikolai Kosjar
2014-04-03 11:23:21 -04:00
parent 76086123c8
commit 3f835d3925
2 changed files with 86 additions and 96 deletions

View File

@@ -121,7 +121,7 @@ public:
enum ForceReason {
NoForce,
ForceDueToMissingSemanticInfo,
ForceDueToInvalidSemanticInfo,
ForceDueEditorRequest
};
@@ -192,11 +192,16 @@ private:
};
SemanticInfo::Source currentSource(bool force);
void recalculateSemanticInfoNow(const SemanticInfo::Source &source, bool emitSignalWhenFinished,
FuturizedTopLevelDeclarationProcessor *processor = 0);
SemanticInfo recalculateSemanticInfoNow(const SemanticInfo::Source &source,
bool emitSignalWhenFinished,
FuturizedTopLevelDeclarationProcessor *processor = 0);
void recalculateSemanticInfoDetached_helper(QFutureInterface<void> &future,
SemanticInfo::Source source);
bool isSemanticInfoValid() const;
SemanticInfo semanticInfo() const;
void setSemanticInfo(const SemanticInfo &semanticInfo, bool emitSignal = true);
QSharedPointer<SnapshotUpdater> snapshotUpdater_internal() const;
void setSnapshotUpdater_internal(const QSharedPointer<SnapshotUpdater> &updater);