diff options
| author | Stefan Löffler <unknown> | 2025-12-31 08:55:32 +1100 |
|---|---|---|
| committer | Stefan Löffler <unknown> | 2025-12-31 08:55:32 +1100 |
| commit | d349445ceff7c209c3edf679cff3147d7201401d (patch) | |
| tree | 8a6fca8b69ff53300484501b4b1047ea1a1caaf3 | |
| parent | fff87cbead74efb59338fb59dd1bf1f25e85e14b (diff) | |
| download | scintilla-mirror-d349445ceff7c209c3edf679cff3147d7201401d.tar.gz | |
Bug [#2495]. Fix crash when using ScintillaDocument object.
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rw-r--r-- | qt/ScintillaEdit/ScintillaDocument.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 528ff351e..25ca454cf 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -610,6 +610,10 @@ On Qt, add const to ScintillaDocument and ScintillaEdit methods. <a href="https://sourceforge.net/p/scintilla/bugs/2494/">Bug #2494</a>. </li> + <li> + On Qt, prevent crash when using ScintillaDocument object. + <a href="https://sourceforge.net/p/scintilla/bugs/2495/">Bug #2495</a>. + </li> </ul> <h3> <a href="https://www.scintilla.org/scintilla558.zip">Release 5.5.8</a> diff --git a/qt/ScintillaEdit/ScintillaDocument.cpp b/qt/ScintillaEdit/ScintillaDocument.cpp index 18cbf5f4f..f532f2726 100644 --- a/qt/ScintillaEdit/ScintillaDocument.cpp +++ b/qt/ScintillaEdit/ScintillaDocument.cpp @@ -101,8 +101,9 @@ ScintillaDocument::ScintillaDocument(QObject *parent, void *pdoc_) : pdoc = new Document(DocumentOption::Default); } docWatcher = new WatcherHelper(this); - (static_cast<Document *>(pdoc))->AddRef(); - (static_cast<Document *>(pdoc))->AddWatcher(docWatcher, pdoc); + Document *doc = static_cast<Document *>(pdoc); + doc->AddRef(); + doc->AddWatcher(docWatcher, doc); } ScintillaDocument::~ScintillaDocument() { |
