diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 8ad50205..0c2d49a2 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -6071,8 +6071,7 @@ void CppParser::internalInvalidateFile(const QString &fileName) } //remove all statements from namespace cache - for (auto it=mNamespaces.begin();it!=mNamespaces.end();++it) { - QString key = it.key(); + for (auto it=mNamespaces.begin();it!=mNamespaces.end();) { PStatementList statements = it.value(); for (int i=statements->size()-1;i>=0;i--) { PStatement statement = statements->at(i); @@ -6081,7 +6080,9 @@ void CppParser::internalInvalidateFile(const QString &fileName) } } if (statements->isEmpty()) { - mNamespaces.remove(key); + it = mNamespaces.erase(it); + } else { + ++it; } } // class inheritance