From a2c362af319af77864456005046ebd09d3ceb41f Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 10 Apr 2018 13:57:17 +0200 Subject: [PATCH] QmlJSEditor: fix crash after document reload Clean up all marks in the document destructor, to prevent accessing already deleted member in a TextMark callback. Task-number: QTCREATORBUG-20199 Change-Id: Ica996ea393b9ae636c731f009a6d39552ff35e26 Reviewed-by: Mitch Curtis Reviewed-by: Marco Benelli --- src/plugins/qmljseditor/qmljseditordocument.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp index 66fa6da393e..4ca53d2ce3b 100644 --- a/src/plugins/qmljseditor/qmljseditordocument.cpp +++ b/src/plugins/qmljseditor/qmljseditordocument.cpp @@ -501,6 +501,10 @@ 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(); + cleanSemanticMarks(); } void QmlJSEditorDocumentPrivate::invalidateFormatterCache()