diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Document.cxx | 12 | ||||
| -rw-r--r-- | src/Document.h | 5 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 6 | 
3 files changed, 14 insertions, 9 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index d7e3bf62b..b4ab37244 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -129,8 +129,6 @@ Document::Document() {  	perLineData[ldAnnotation] = new LineAnnotation();  	cb.SetPerLine(this); - -	pli = 0;  }  Document::~Document() { @@ -142,8 +140,6 @@ Document::~Document() {  		pl = nullptr;  	}  	regex.release(); -	delete pli; -	pli = 0;  	delete pcf;  	pcf = 0;  } @@ -2124,6 +2120,14 @@ void Document::LexerChanged() {  	}  } +LexInterface *Document::GetLexInterface() const { +	return pli.get(); +} + +void Document::SetLexInterface(LexInterface *pLexInterface) { +	pli.reset(pLexInterface); +} +  int SCI_METHOD Document::SetLineState(Sci_Position line, int state) {  	const int statePrevious = static_cast<LineState *>(perLineData[ldState])->SetLineState(line, state);  	if (state != statePrevious) { diff --git a/src/Document.h b/src/Document.h index b6c9c5bd1..788f9bd33 100644 --- a/src/Document.h +++ b/src/Document.h @@ -228,6 +228,7 @@ private:  	bool matchesValid;  	std::unique_ptr<RegexSearchBase> regex; +	std::unique_ptr<LexInterface> pli;  public: @@ -243,8 +244,6 @@ public:  		}  	}; -	LexInterface *pli; -  	int eolMode;  	/// Can also be SC_CP_UTF8 to enable UTF-8 mode  	int dbcsCodePage; @@ -415,6 +414,8 @@ public:  	void IncrementStyleClock();  	void SCI_METHOD DecorationSetCurrentIndicator(int indicator);  	void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength); +	LexInterface *GetLexInterface() const; +	void SetLexInterface(LexInterface *pLexInterface);  	int SCI_METHOD SetLineState(Sci_Position line, int state);  	int SCI_METHOD GetLineState(Sci_Position line) const; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 659a37b90..0fbf555d1 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -581,10 +581,10 @@ LexState::~LexState() {  }  LexState *ScintillaBase::DocumentLexState() { -	if (!pdoc->pli) { -		pdoc->pli = new LexState(pdoc); +	if (!pdoc->GetLexInterface()) { +		pdoc->SetLexInterface(new LexState(pdoc));  	} -	return static_cast<LexState *>(pdoc->pli); +	return static_cast<LexState *>(pdoc->GetLexInterface());  }  void LexState::SetLexerModule(const LexerModule *lex) {  | 
