From a0ebebe503affd3447a29c1253579f392cc45132 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/Editor.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/Editor.cxx') diff --git a/src/Editor.cxx b/src/Editor.cxx index e6a72e4cd..041a9c6a5 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2258,7 +2258,7 @@ void Editor::LayoutLine(int line, Surface *surface, const ViewStyle &vstyle, Lin ll->positions[0] = 0; bool lastSegItalics = false; - BreakFinder bfLayout(ll, 0, numCharsInLine, posLineStart, 0, false, pdoc, &reprs); + BreakFinder bfLayout(ll, NULL, 0, numCharsInLine, posLineStart, 0, false, pdoc, &reprs); while (bfLayout.More()) { const TextSegment ts = bfLayout.Next(); @@ -2898,10 +2898,8 @@ void Editor::DrawLine(Surface *surface, const ViewStyle &vsDraw, int line, int l // Does not take margin into account but not significant const int xStartVisible = static_cast(subLineStart) - xStart; - ll->psel = &sel; - if (twoPhaseDraw) { - BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, xStartVisible, selBackDrawn, pdoc, &reprs); + BreakFinder bfBack(ll, &sel, lineStart, lineEnd, posLineStart, xStartVisible, selBackDrawn, pdoc, &reprs); // Background drawing loop while (bfBack.More()) { @@ -2994,7 +2992,7 @@ void Editor::DrawLine(Surface *surface, const ViewStyle &vsDraw, int line, int l inIndentation = subLine == 0; // Do not handle indentation except on first subline. // Foreground drawing loop - BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, xStartVisible, + BreakFinder bfFore(ll, &sel, lineStart, lineEnd, posLineStart, xStartVisible, ((!twoPhaseDraw && selBackDrawn) || vsDraw.selColours.fore.isSet), pdoc, &reprs); while (bfFore.More()) { -- cgit v1.2.3