woohyun pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=79d95a289ad571d666c93c9f47f8557621175fe9

commit 79d95a289ad571d666c93c9f47f8557621175fe9
Author: Ali Alzyod <[email protected]>
Date:   Tue Dec 24 17:17:31 2019 +0900

    efl_text_cursor: assign source textobject to destination  on cursor_copy
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Maniphest Tasks: T8454
    
    Differential Revision: https://phab.enlightenment.org/D10951
---
 src/lib/evas/canvas/efl_text_cursor.c | 6 +++++-
 src/tests/evas/evas_test_textblock.c  | 6 ++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/efl_text_cursor.c 
b/src/lib/evas/canvas/efl_text_cursor.c
index 54c9ad5f85..b52298c1c0 100644
--- a/src/lib/evas/canvas/efl_text_cursor.c
+++ b/src/lib/evas/canvas/efl_text_cursor.c
@@ -105,10 +105,13 @@ _efl_text_cursor_compare(const Eo *obj EINA_UNUSED, 
Efl_Text_Cursor_Data *pd, co
 EOLIAN static void
 _efl_text_cursor_copy(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, 
Efl_Text_Cursor *dst)
 {
+   Efl_Text_Cursor_Data *pd_dest = efl_data_scope_safe_get(dst, MY_CLASS);
+   EINA_SAFETY_ON_NULL_RETURN(pd_dest);
    if (!pd->handle) return;
 
    Efl_Text_Cursor_Handle *handle = 
evas_object_textblock_cursor_new(pd->handle->obj);
    evas_textblock_cursor_copy(pd->handle, handle);
+   pd_dest->text_obj = pd->text_obj;
    efl_text_cursor_handle_set(dst, handle);
    evas_textblock_cursor_unref(handle, NULL);
 }
@@ -432,7 +435,8 @@ efl_text_cursor_handle_get(const Eo *obj)
 
 void efl_text_cursor_text_object_set(Eo *cursor, Eo *canvas_text_obj, Eo 
*text_obj)
 {
-   Efl_Text_Cursor_Data *pd = efl_data_scope_get(cursor, MY_CLASS);
+   Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(cursor, MY_CLASS);
+   EINA_SAFETY_ON_NULL_RETURN(pd);
    Efl_Text_Cursor_Handle *handle = NULL;
    if (efl_isa(canvas_text_obj, EFL_CANVAS_TEXTBLOCK_CLASS))
      {
diff --git a/src/tests/evas/evas_test_textblock.c 
b/src/tests/evas/evas_test_textblock.c
index 43be1fcd53..f4806cb459 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -4516,6 +4516,12 @@ EFL_START_TEST(efl_canvas_textblock_cursor)
 
    ck_assert_int_eq(changed_emit, 3);
 
+   Eo *cursor_temp = efl_add(EFL_TEXT_CURSOR_CLASS, txt);
+   efl_text_cursor_copy(cursor1 ,cursor_temp);
+   ck_assert_ptr_eq(
+      efl_text_cursor_text_object_get(cursor1),
+      efl_text_cursor_text_object_get(cursor_temp));
+
    END_EFL_CANVAS_TEXTBLOCK_TEST();
 }
 EFL_END_TEST

-- 


Reply via email to