From: Victor Cebollada Date: Wed, 8 Mar 2017 11:24:19 +0000 (+0000) Subject: Fix for Text::Controller::RepositionSelectionHandles() X-Git-Tag: dali_1.2.30~7^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=ae2665cec4c07a353cf801b3768f31626bd86dbb;hp=bec4d9ff911814a00ed7ed2964beaabea5e1e178 Fix for Text::Controller::RepositionSelectionHandles() * Fixes an invalid memory read reported by valgrind. Change-Id: I8625fdbd3203130b73327964d9b5ae063677938f Signed-off-by: Victor Cebollada --- diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 2c1b772..c54ca22 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -1964,15 +1964,15 @@ void Controller::Impl::RepositionSelectionHandles() // Whether to retrieve the next line. if( index == lastGlyphOfLine ) { - // Retrieve the next line. - ++lineRun; - - // Get the last glyph of the new line. - lastGlyphOfLine = lineRun->glyphRun.glyphIndex + lineRun->glyphRun.numberOfGlyphs - 1u; - ++lineIndex; if( lineIndex < firstLineIndex + numberOfLines ) { + // Retrieve the next line. + ++lineRun; + + // Get the last glyph of the new line. + lastGlyphOfLine = lineRun->glyphRun.glyphIndex + lineRun->glyphRun.numberOfGlyphs - 1u; + // Keep the offset and height of the current selection box. const float currentLineOffset = selectionBoxInfo->lineOffset; const float currentLineHeight = selectionBoxInfo->lineHeight;