forked from qt-creator/qt-creator
TextEditor: Fix crash on reloading the document
as part of the reload operation we set the document to nullptr inside TextBlockUserData::documentClosing, but we do not remove the mark from the marks cache. So when a text mark gets deleted while a document is reloaded the mark does not get readded to the document, but it wont get removed from the marks cache inside the document either, so we have to manually make sure the mark is removed from the cache in this situation. Fixes: QTCREATORBUG-29432 Change-Id: I3ae4182c4d2bbd3426c1d7a60275d21ac20ea99a Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -837,7 +837,7 @@ bool TextDocument::reload(QString *errorString, const FilePath &realFilePath)
|
||||
auto documentLayout =
|
||||
qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout());
|
||||
if (documentLayout)
|
||||
documentLayout->documentAboutToReload(); // removes text marks non-permanently
|
||||
documentLayout->documentAboutToReload(this); // removes text marks non-permanently
|
||||
|
||||
bool success = openImpl(errorString, filePath(), realFilePath, /*reload =*/true)
|
||||
== OpenResult::Success;
|
||||
|
||||
Reference in New Issue
Block a user