aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-06-22 13:44:46 +1000
committerNeil <nyamatongwe@gmail.com>2014-06-22 13:44:46 +1000
commit47ac30dfae520dd56e0c4cd20827d65bae25e073 (patch)
treeb032e0dc0eda28a8e64977298dcc04e884f5ce5e /src/PositionCache.cxx
parent93c33490b77157f2e5422f4962ac4b88f4aea7c5 (diff)
downloadscintilla-mirror-47ac30dfae520dd56e0c4cd20827d65bae25e073.tar.gz
Stop storing a pointer to the selection on LineLayout objects where it may have
a lifetime that is too long. Instead provide it as an argument to BreakFinder where it is only needed during intialisation.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index e35a1714c..f61999a4b 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -54,7 +54,6 @@ LineLayout::LineLayout(int maxLineLength_) :
validity(llInvalid),
xHighlightGuide(0),
highlightColumn(0),
- psel(NULL),
containsCaret(false),
edgeColumn(0),
chars(0),
@@ -440,7 +439,7 @@ void BreakFinder::Insert(int val) {
}
}
-BreakFinder::BreakFinder(const LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
+BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_,
int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_) :
ll(ll_),
lineStart(lineStart_),
@@ -467,8 +466,8 @@ BreakFinder::BreakFinder(const LineLayout *ll_, int lineStart_, int lineEnd_, in
SelectionPosition posStart(posLineStart);
SelectionPosition posEnd(posLineStart + lineEnd);
SelectionSegment segmentLine(posStart, posEnd);
- for (size_t r=0; r<ll->psel->Count(); r++) {
- SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine);
+ for (size_t r=0; r<psel->Count(); r++) {
+ SelectionSegment portion = psel->Range(r).Intersect(segmentLine);
if (!(portion.start == portion.end)) {
if (portion.start.IsValid())
Insert(portion.start.Position() - posLineStart);