forked from qt-creator/qt-creator
QmlDesigner: Add mutex
Creating models can trigger this initialization potentially from multiple threads. Task-number: QDS-6429 Change-Id: I1e9f715c150e37e6381c3f4e94fe6de1aaec7556 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -32,9 +32,9 @@
|
||||
#include <coreplugin/messagebox.h>
|
||||
#include "pluginmanager/widgetpluginmanager.h"
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QMutex>
|
||||
|
||||
enum {
|
||||
debug = false
|
||||
@@ -107,6 +107,7 @@ void MetaInfoPrivate::parseItemLibraryDescriptions()
|
||||
using QmlDesigner::Internal::MetaInfoPrivate;
|
||||
|
||||
MetaInfo MetaInfo::s_global;
|
||||
QMutex s_lock;
|
||||
QStringList MetaInfo::s_pluginDirs;
|
||||
|
||||
|
||||
@@ -157,6 +158,8 @@ ItemLibraryInfo *MetaInfo::itemLibraryInfo() const
|
||||
*/
|
||||
MetaInfo MetaInfo::global()
|
||||
{
|
||||
QMutexLocker locker(&s_lock);
|
||||
|
||||
if (!s_global.m_p->m_isInitialized) {
|
||||
s_global.m_p = QSharedPointer<MetaInfoPrivate>(new MetaInfoPrivate(&s_global));
|
||||
s_global.m_p->initialize();
|
||||
|
Reference in New Issue
Block a user