forked from qt-creator/qt-creator
QmlJSEditor: do not wait for the semantic info update
... when destructing a qmljseditor. Just let the updater continue and delete it once it finishes. Fixes: QTCREATORBUG-28206 Change-Id: Icabe10f17b7bf326bb15e5ee622504c477d83acf Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
@@ -483,7 +483,9 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare
|
|||||||
&Internal::QmlJSEditorDocumentPrivate::settingsChanged);
|
&Internal::QmlJSEditorDocumentPrivate::settingsChanged);
|
||||||
|
|
||||||
// semantic info
|
// semantic info
|
||||||
m_semanticInfoUpdater = new SemanticInfoUpdater(this);
|
m_semanticInfoUpdater = new SemanticInfoUpdater();
|
||||||
|
connect(m_semanticInfoUpdater, &SemanticInfoUpdater::finished,
|
||||||
|
m_semanticInfoUpdater, &QObject::deleteLater);
|
||||||
connect(m_semanticInfoUpdater, &SemanticInfoUpdater::updated,
|
connect(m_semanticInfoUpdater, &SemanticInfoUpdater::updated,
|
||||||
this, &QmlJSEditorDocumentPrivate::acceptNewSemanticInfo);
|
this, &QmlJSEditorDocumentPrivate::acceptNewSemanticInfo);
|
||||||
m_semanticInfoUpdater->start();
|
m_semanticInfoUpdater->start();
|
||||||
@@ -509,7 +511,6 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare
|
|||||||
QmlJSEditorDocumentPrivate::~QmlJSEditorDocumentPrivate()
|
QmlJSEditorDocumentPrivate::~QmlJSEditorDocumentPrivate()
|
||||||
{
|
{
|
||||||
m_semanticInfoUpdater->abort();
|
m_semanticInfoUpdater->abort();
|
||||||
m_semanticInfoUpdater->wait();
|
|
||||||
// clean up all marks, otherwise a callback could try to access deleted members.
|
// clean up all marks, otherwise a callback could try to access deleted members.
|
||||||
// see QTCREATORBUG-20199
|
// see QTCREATORBUG-20199
|
||||||
cleanDiagnosticMarks();
|
cleanDiagnosticMarks();
|
||||||
|
|||||||
@@ -19,11 +19,7 @@
|
|||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
SemanticInfoUpdater::SemanticInfoUpdater(QObject *parent)
|
SemanticInfoUpdater::SemanticInfoUpdater() = default;
|
||||||
: QThread(parent)
|
|
||||||
, m_wasCancelled(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SemanticInfoUpdater::~SemanticInfoUpdater() = default;
|
SemanticInfoUpdater::~SemanticInfoUpdater() = default;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class SemanticInfoUpdater: public QThread
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SemanticInfoUpdater(QObject *parent = nullptr);
|
SemanticInfoUpdater();
|
||||||
~SemanticInfoUpdater() override;
|
~SemanticInfoUpdater() override;
|
||||||
|
|
||||||
void abort();
|
void abort();
|
||||||
@@ -39,7 +39,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
QWaitCondition m_condition;
|
QWaitCondition m_condition;
|
||||||
bool m_wasCancelled;
|
bool m_wasCancelled = false;
|
||||||
QmlJS::Document::Ptr m_sourceDocument;
|
QmlJS::Document::Ptr m_sourceDocument;
|
||||||
QmlJS::Snapshot m_sourceSnapshot;
|
QmlJS::Snapshot m_sourceSnapshot;
|
||||||
QmlJSTools::SemanticInfo m_lastSemanticInfo;
|
QmlJSTools::SemanticInfo m_lastSemanticInfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user