diff options
author | David Schulz <david.schulz@qt.io> | 2023-04-05 12:48:19 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2023-04-13 06:09:10 +0000 |
commit | f773c09f33a81880ea38199b5fe49d6ba67b8b69 (patch) | |
tree | 0916c0f26cbfc32681b9b5b475568cf344bb9766 /src/plugins/texteditor/textmark.h | |
parent | 78cf563142efe442796ff74d332c1d96024d1fde (diff) |
TextEditor: fix crash on reload
Since TextDocument::openImpl potentially processes events it could
delete TextMarks. So tracking them in TextDocument::reload can be
considered unsafe. Track them in TextDocumentLayout instead and remove
the tracked mark if it gets deleted while reloading the document.
Task-number: QTCREATORBUG-29004
Change-Id: I9d0478e9c763b49f145c1bbaeed1a0b602757014
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/plugins/texteditor/textmark.h')
-rw-r--r-- | src/plugins/texteditor/textmark.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h index 7271255705..927255161d 100644 --- a/src/plugins/texteditor/textmark.h +++ b/src/plugins/texteditor/textmark.h @@ -118,12 +118,15 @@ public: bool isLocationMarker() const;; void setIsLocationMarker(bool newIsLocationMarker); + protected: void setSettingsPage(Utils::Id settingsPage); private: Q_DISABLE_COPY(TextMark) + void setDeleteCallback(const std::function<void()> &callback) { m_deleteCallback = callback; }; + TextDocument *m_baseTextDocument = nullptr; Utils::FilePath m_fileName; int m_lineNumber = 0; @@ -141,6 +144,9 @@ private: QVector<QAction *> m_actions; // FIXME Remove in master std::function<QList<QAction *>()> m_actionsProvider; Utils::Id m_settingsPage; + std::function<void()> m_deleteCallback; + + friend class TextDocumentLayout; }; } // namespace TextEditor |