From: Bowon Ryu Date: Fri, 10 Sep 2021 05:22:20 +0000 (+0900) Subject: Add exception handling in text-controller X-Git-Tag: dali_2.0.44~6 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=a96792fc04dcf6a4bba17985fd940a4256c1820e;hp=f15cbe6c00c4bcb9baffe8d6f95747e3c2e051d1;ds=sidebyside Add exception handling in text-controller There is a case where mGlyphPositions is cleared in Controller::Relayouter::Relayout. At this time, if try to partially erase mGlyphPositions in ClearGlyphModelData, Assert occurs. Because the count of mGlyphPositions is already 0. This patch prevents this issue though a count check. Change-Id: I00c919c75acd1d389877c55acfcd75878b28bc91 Signed-off-by: Bowon Ryu --- diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index b298bf0..045fb8a 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -507,10 +507,14 @@ void Controller::Impl::ClearGlyphModelData(CharacterIndex startIndex, CharacterI mModel->mVisualModel->mCharactersPerGlyph.Erase(charactersPerGlyphBuffer + mTextUpdateInfo.mStartGlyphIndex, charactersPerGlyphBuffer + endGlyphIndexPlusOne); - // Clear the positions buffer. - Vector2* positionsBuffer = mModel->mVisualModel->mGlyphPositions.Begin(); - mModel->mVisualModel->mGlyphPositions.Erase(positionsBuffer + mTextUpdateInfo.mStartGlyphIndex, - positionsBuffer + endGlyphIndexPlusOne); + // Should pass if mGlyphPositions has already been cleared in Controller::Relayouter::Relayout + if(0u != mModel->mVisualModel->mGlyphPositions.Count()) + { + // Clear the positions buffer. + Vector2* positionsBuffer = mModel->mVisualModel->mGlyphPositions.Begin(); + mModel->mVisualModel->mGlyphPositions.Erase(positionsBuffer + mTextUpdateInfo.mStartGlyphIndex, + positionsBuffer + endGlyphIndexPlusOne); + } } if(NO_OPERATION != (LAYOUT & operations))