diff options
-rw-r--r-- | src/Document.cxx | 6 | ||||
-rw-r--r-- | src/Document.h | 4 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 2c2d86de6..6b93a30af 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2262,12 +2262,12 @@ void Document::LexerChanged() { } } -LexInterface *Document::GetLexInterface() const { +LexInterface *Document::GetLexInterface() const noexcept { return pli.get(); } -void Document::SetLexInterface(LexInterface *pLexInterface) { - pli.reset(pLexInterface); +void Document::SetLexInterface(std::unique_ptr<LexInterface> pLexInterface) noexcept { + pli = std::move(pLexInterface); } int SCI_METHOD Document::SetLineState(Sci_Position line, int state) { diff --git a/src/Document.h b/src/Document.h index ea89877ec..c96fe9ee7 100644 --- a/src/Document.h +++ b/src/Document.h @@ -459,8 +459,8 @@ public: void IncrementStyleClock() noexcept; void SCI_METHOD DecorationSetCurrentIndicator(int indicator) override; void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) override; - LexInterface *GetLexInterface() const; - void SetLexInterface(LexInterface *pLexInterface); + LexInterface *GetLexInterface() const noexcept; + void SetLexInterface(std::unique_ptr<LexInterface> pLexInterface) noexcept; int SCI_METHOD SetLineState(Sci_Position line, int state) override; int SCI_METHOD GetLineState(Sci_Position line) const override; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 2098fcb6f..8e3a86c15 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -620,7 +620,7 @@ void LexState::SetInstance(ILexer5 *instance_) { LexState *ScintillaBase::DocumentLexState() { if (!pdoc->GetLexInterface()) { - pdoc->SetLexInterface(new LexState(pdoc)); + pdoc->SetLexInterface(std::make_unique<LexState>(pdoc)); } return dynamic_cast<LexState *>(pdoc->GetLexInterface()); } |