Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / tizen-wayland / input-method-context-impl-ecore-wl.cpp
index 73b1a43..b5bf294 100755 (executable)
@@ -604,33 +604,36 @@ bool InputMethodContextEcoreWl::RetrieveSurrounding( void* data, ImfContext* imf
 
   if( callbackData.update )
   {
+    if( cursorPosition )
+    {
+      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
+      *cursorPosition = mIMFCursorPosition;
+    }
+
     if( text )
     {
       const char* plainText = callbackData.currentText.c_str();
+
       if( plainText )
       {
+        // The memory allocated by strdup() can be freed by ecore_imf_context_surrounding_get() internally.
+        *text = strdup( plainText );
+
         // If the current input panel is password mode, dali should replace the plain text with '*' (Asterisk) character.
         if( ecore_imf_context_input_hint_get( mIMFContext ) & ECORE_IMF_INPUT_HINT_SENSITIVE_DATA )
         {
-          char* iter = NULL;
-          for( iter = const_cast<char*>( plainText ); iter && *iter; ++iter )
+          for( char* iter = *text; *iter; ++iter )
           {
             *iter = '*';
           }
         }
-      }
-      // The memory allocated by strdup() can be freed by ecore_imf_context_surrounding_get() internally.
-      *text = strdup( plainText );
-    }
 
-    if( cursorPosition )
-    {
-      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
-      *cursorPosition = mIMFCursorPosition;
+        return EINA_TRUE;
+      }
     }
   }
 
-  return EINA_TRUE;
+  return EINA_FALSE;
 }
 
 /**