QmlJS: Exchange unsafe meta calls with QTimer::singleShot

Change-Id: I5596c3f506f1fb873536c03ed5b8f5df88f5ea06
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Eike Ziller
2016-01-25 15:16:34 +01:00
parent f26a4c2954
commit a2e19ba1be

View File

@@ -40,7 +40,6 @@
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QMetaObject>
#include <QRegExp>
#include <QTextDocument>
#include <QTextStream>
@@ -1217,8 +1216,7 @@ void ModelManagerInterface::maybeQueueCppQmlTypeUpdate(const CPlusPlus::Document
doc->releaseSourceAndAST();
// delegate actual queuing to the gui thread
QMetaObject::invokeMethod(this, "queueCppQmlTypeUpdate",
Q_ARG(CPlusPlus::Document::Ptr, doc), Q_ARG(bool, scan));
QTimer::singleShot(0, this, [this, doc, scan]() { queueCppQmlTypeUpdate(doc, scan); });
}
void ModelManagerInterface::queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc, bool scan)
@@ -1315,7 +1313,7 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
qmlModelManager->m_cppDataHash = newData;
if (hasNewInfo)
// one could get away with re-linking the cpp types...
QMetaObject::invokeMethod(qmlModelManager, "asyncReset");
QTimer::singleShot(0, qmlModelManager, &ModelManagerInterface::asyncReset);
}
ModelManagerInterface::CppDataHash ModelManagerInterface::cppData() const