forked from qt-creator/qt-creator
CppEditor: Fix a crash on concurrent access to knownNames
Fixes: QTCREATORBUG-31569 Change-Id: Ic7248facf78c7778aae50a598c01c77e6b2897c1 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -146,22 +146,22 @@ void moveCursorToStartOfIdentifier(QTextCursor *tc)
|
|||||||
|
|
||||||
static bool isOwnershipRAIIName(const QString &name)
|
static bool isOwnershipRAIIName(const QString &name)
|
||||||
{
|
{
|
||||||
static QSet<QString> knownNames;
|
static const QSet<QString> knownNames {
|
||||||
if (knownNames.isEmpty()) {
|
|
||||||
// Qt
|
// Qt
|
||||||
knownNames.insert(QLatin1String("QScopedPointer"));
|
"QMutexLocker",
|
||||||
knownNames.insert(QLatin1String("QScopedArrayPointer"));
|
"QReadLocker",
|
||||||
knownNames.insert(QLatin1String("QMutexLocker"));
|
"QScopedArrayPointer",
|
||||||
knownNames.insert(QLatin1String("QReadLocker"));
|
"QScopedPointer",
|
||||||
knownNames.insert(QLatin1String("QWriteLocker"));
|
"QWriteLocker",
|
||||||
// Standard C++
|
|
||||||
knownNames.insert(QLatin1String("auto_ptr"));
|
|
||||||
knownNames.insert(QLatin1String("unique_ptr"));
|
|
||||||
// Boost
|
|
||||||
knownNames.insert(QLatin1String("scoped_ptr"));
|
|
||||||
knownNames.insert(QLatin1String("scoped_array"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Standard C++
|
||||||
|
"auto_ptr",
|
||||||
|
"unique_ptr",
|
||||||
|
|
||||||
|
// Boost
|
||||||
|
"scoped_array",
|
||||||
|
"scoped_ptr",
|
||||||
|
};
|
||||||
return knownNames.contains(name);
|
return knownNames.contains(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user