Commit e8ba82f1 authored by Roberto Raggi's avatar Roberto Raggi

Protected modelmanager's snapshot.

parent c5507b63
......@@ -582,6 +582,7 @@ CppModelManager::~CppModelManager()
Snapshot CppModelManager::snapshot() const
{
QMutexLocker locker(&protectSnapshot);
return m_snapshot;
}
......@@ -795,7 +796,11 @@ void CppModelManager::emitDocumentUpdated(Document::Ptr doc)
void CppModelManager::onDocumentUpdated(Document::Ptr doc)
{
const QString fileName = doc->fileName();
m_snapshot[fileName] = doc;
protectSnapshot.lock();
m_snapshot.insert(doc);
protectSnapshot.unlock();
QList<Core::IEditor *> openedEditors = m_core->editorManager()->openedEditors();
foreach (Core::IEditor *editor, openedEditors) {
if (editor->file()->fileName() == fileName) {
......@@ -1074,7 +1079,9 @@ void CppModelManager::parse(QFutureInterface<void> &future,
void CppModelManager::GC()
{
protectSnapshot.lock();
Snapshot documents = m_snapshot;
protectSnapshot.unlock();
QSet<QString> processed;
QStringList todo = projectFiles();
......@@ -1105,7 +1112,10 @@ void CppModelManager::GC()
}
emit aboutToRemoveFiles(removedFiles);
protectSnapshot.lock();
m_snapshot = documents;
protectSnapshot.unlock();
}
......@@ -170,6 +170,7 @@ private:
QMap<ProjectExplorer::Project *, ProjectInfo> m_projects;
mutable QMutex mutex;
mutable QMutex protectSnapshot;
struct Editor {
QPointer<TextEditor::ITextEditor> textEditor;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment