fixed Crash when entering backspace in texteditor 84/215184/1
authorJoogab Yun <joogab.yun@samsung.com>
Wed, 2 Oct 2019 08:17:03 +0000 (17:17 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Wed, 2 Oct 2019 08:17:03 +0000 (17:17 +0900)
If you type text as multiline and then delete the backspace, crash will occur.

    textEditor = TextEditor::New();
    textEditor.SetBackgroundColor( Color::CYAN );
    textEditor.SetSize( 500.f, 500.f );
    textEditor.SetPosition( 100.f, 150.f );
    textEditor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    stage.Add( textEditor );

Change-Id: I83a6cd986dd646b2c45efffc048e3d36b479ad5f

dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller.cpp

index e333be2..90eb88c 100755 (executable)
@@ -814,7 +814,7 @@ bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
 
   // Check whether the indices for updating the text is valid
   if ( numberOfCharacters > 0u &&
 
   // Check whether the indices for updating the text is valid
   if ( numberOfCharacters > 0u &&
-       ( mTextUpdateInfo.mParagraphCharacterIndex >= numberOfCharacters ||
+       ( mTextUpdateInfo.mParagraphCharacterIndex > numberOfCharacters ||
          mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters ) )
   {
     std::string currentText;
          mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters ) )
   {
     std::string currentText;
index 5ca9858..2f3306b 100755 (executable)
@@ -3775,7 +3775,7 @@ bool Controller::DoRelayout( const Size& size,
     // Make sure the index is not out of bound
     if ( charactersToGlyph.Count() != glyphsPerCharacter.Count() ||
          requestedNumberOfCharacters > charactersToGlyph.Count() ||
     // Make sure the index is not out of bound
     if ( charactersToGlyph.Count() != glyphsPerCharacter.Count() ||
          requestedNumberOfCharacters > charactersToGlyph.Count() ||
-         ( lastIndex >= charactersToGlyph.Count() && charactersToGlyph.Count() > 0u ) )
+         ( lastIndex > charactersToGlyph.Count() && charactersToGlyph.Count() > 0u ) )
     {
       std::string currentText;
       GetText( currentText );
     {
       std::string currentText;
       GetText( currentText );