From 47ac30dfae520dd56e0c4cd20827d65bae25e073 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 22 Jun 2014 13:44:46 +1000 Subject: 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. --- src/PositionCache.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/PositionCache.cxx') 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; rpsel->Count(); r++) { - SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine); + for (size_t r=0; rCount(); r++) { + SelectionSegment portion = psel->Range(r).Intersect(segmentLine); if (!(portion.start == portion.end)) { if (portion.start.IsValid()) Insert(portion.start.Position() - posLineStart); -- cgit v1.2.3