diff options
| author | mitchell <unknown> | 2020-04-05 16:04:05 -0400 |
|---|---|---|
| committer | mitchell <unknown> | 2020-04-05 16:04:05 -0400 |
| commit | 8898dd74337c8fb7ac76e157f9afee38ffbe1438 (patch) | |
| tree | 28ca18802243188ec19e6412320257034e25b29e | |
| parent | 65c3b110e48a73b4bc6fe2cb1f37d2415c0aa3d2 (diff) | |
| download | scintilla-mirror-8898dd74337c8fb7ac76e157f9afee38ffbe1438.tar.gz | |
Backport: Pass argument as unique_ptr to show transfer of ownership. Add const and noexcept.
Backport of changeset 8106:f26e186e80a9.
| -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 d85b71106..6670bbdb3 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2265,12 +2265,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 f105e825a..efce835d4 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 0975028f3..082cb82d5 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -615,7 +615,7 @@ LexState::~LexState() { LexState *ScintillaBase::DocumentLexState() { if (!pdoc->GetLexInterface()) { - pdoc->SetLexInterface(new LexState(pdoc)); + pdoc->SetLexInterface(Sci::make_unique<LexState>(pdoc)); } return dynamic_cast<LexState *>(pdoc->GetLexInterface()); } |
