From d349445ceff7c209c3edf679cff3147d7201401d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20L=C3=B6ffler?= Date: Wed, 31 Dec 2025 08:55:32 +1100 Subject: Bug [#2495]. Fix crash when using ScintillaDocument object. --- doc/ScintillaHistory.html | 4 ++++ 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. Bug #2494. +
  • + On Qt, prevent crash when using ScintillaDocument object. + Bug #2495. +
  • Release 5.5.8 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(pdoc))->AddRef(); - (static_cast(pdoc))->AddWatcher(docWatcher, pdoc); + Document *doc = static_cast(pdoc); + doc->AddRef(); + doc->AddWatcher(docWatcher, doc); } ScintillaDocument::~ScintillaDocument() { -- cgit v1.2.3