forked from qt-creator/qt-creator
CppEditor: Fix crash when calling CppModelManager::projectPart
find and end of QMap potentially detach the container, so we have to use constFind and constEnd Fixes: QTCREATORBUG-29716 Change-Id: I2fef46580ff5b58a70201841423e5ca0a7b4d107 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -1647,8 +1647,8 @@ QList<ProjectPart::ConstPtr> CppModelManager::projectPart(const FilePath &fileNa
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
QReadLocker locker(&d->m_projectLock);
|
QReadLocker locker(&d->m_projectLock);
|
||||||
auto it = d->m_fileToProjectParts.find(fileName);
|
auto it = d->m_fileToProjectParts.constFind(fileName);
|
||||||
if (it != d->m_fileToProjectParts.end())
|
if (it != d->m_fileToProjectParts.constEnd())
|
||||||
return it.value();
|
return it.value();
|
||||||
}
|
}
|
||||||
const FilePath canonicalPath = fileName.canonicalPath();
|
const FilePath canonicalPath = fileName.canonicalPath();
|
||||||
|
Reference in New Issue
Block a user