diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp index 496070f1a04..6b602130930 100644 --- a/src/plugins/qmljseditor/qmljseditordocument.cpp +++ b/src/plugins/qmljseditor/qmljseditordocument.cpp @@ -483,7 +483,9 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare &Internal::QmlJSEditorDocumentPrivate::settingsChanged); // 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, this, &QmlJSEditorDocumentPrivate::acceptNewSemanticInfo); m_semanticInfoUpdater->start(); @@ -509,7 +511,6 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare QmlJSEditorDocumentPrivate::~QmlJSEditorDocumentPrivate() { m_semanticInfoUpdater->abort(); - m_semanticInfoUpdater->wait(); // clean up all marks, otherwise a callback could try to access deleted members. // see QTCREATORBUG-20199 cleanDiagnosticMarks(); diff --git a/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp b/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp index bf1a5f4e1a5..a01b4416fb1 100644 --- a/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp +++ b/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp @@ -19,11 +19,7 @@ namespace QmlJSEditor { namespace Internal { -SemanticInfoUpdater::SemanticInfoUpdater(QObject *parent) - : QThread(parent) - , m_wasCancelled(false) -{ -} +SemanticInfoUpdater::SemanticInfoUpdater() = default; SemanticInfoUpdater::~SemanticInfoUpdater() = default; diff --git a/src/plugins/qmljseditor/qmljssemanticinfoupdater.h b/src/plugins/qmljseditor/qmljssemanticinfoupdater.h index b038ed94ab2..0d0ac4032d7 100644 --- a/src/plugins/qmljseditor/qmljssemanticinfoupdater.h +++ b/src/plugins/qmljseditor/qmljssemanticinfoupdater.h @@ -19,7 +19,7 @@ class SemanticInfoUpdater: public QThread Q_OBJECT public: - SemanticInfoUpdater(QObject *parent = nullptr); + SemanticInfoUpdater(); ~SemanticInfoUpdater() override; void abort(); @@ -39,7 +39,7 @@ private: private: QMutex m_mutex; QWaitCondition m_condition; - bool m_wasCancelled; + bool m_wasCancelled = false; QmlJS::Document::Ptr m_sourceDocument; QmlJS::Snapshot m_sourceSnapshot; QmlJSTools::SemanticInfo m_lastSemanticInfo;