forked from qt-creator/qt-creator
Revert "QmlJS: Exchange unsafe meta calls with QTimer::singleShot"
QTimer::singleShot with a member function pointer or a lambda does
not schedule the invocation directly on the receivers event loop,
even if the timeout is 0. It actually creates a timer in the thread
where QTimer::singleShot is called, which requires an event dispatcher
to be available. Only the timer's timeout() signal then schedules the
invocation on the receivers thread.
We do not want to actually run an event loop here until a timer fires.
Even if a timer with timeout 0 might directly schedule the timeout
event on the event dispatcher without involving actual timers, and
even if that event dispatcher makes sure all events are handled before
deleting itself, it would feel like relying on an implementation
detail.
This reverts commit a2e19ba1be
.
Task-number: QTCREATORBUG-15681
Change-Id: I19846ce089d72c971d3cc5927c2ddf563e06de14
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
d5ecd4cf8b
commit
a6e6c88ed8
@@ -40,6 +40,7 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMetaObject>
|
||||
#include <QRegExp>
|
||||
#include <QTextDocument>
|
||||
#include <QTextStream>
|
||||
@@ -1216,7 +1217,8 @@ void ModelManagerInterface::maybeQueueCppQmlTypeUpdate(const CPlusPlus::Document
|
||||
doc->releaseSourceAndAST();
|
||||
|
||||
// delegate actual queuing to the gui thread
|
||||
QTimer::singleShot(0, this, [this, doc, scan]() { queueCppQmlTypeUpdate(doc, scan); });
|
||||
QMetaObject::invokeMethod(this, "queueCppQmlTypeUpdate",
|
||||
Q_ARG(CPlusPlus::Document::Ptr, doc), Q_ARG(bool, scan));
|
||||
}
|
||||
|
||||
void ModelManagerInterface::queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc, bool scan)
|
||||
@@ -1315,7 +1317,7 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
|
||||
qmlModelManager->m_cppDataHash = newData;
|
||||
if (hasNewInfo)
|
||||
// one could get away with re-linking the cpp types...
|
||||
QTimer::singleShot(0, qmlModelManager, &ModelManagerInterface::asyncReset);
|
||||
QMetaObject::invokeMethod(qmlModelManager, "asyncReset");
|
||||
}
|
||||
|
||||
ModelManagerInterface::CppDataHash ModelManagerInterface::cppData() const
|
||||
|
Reference in New Issue
Block a user