Page MenuHomePhabricator

Application Crashes while using ellipsis=0 with both RTL and LTR Languages
Open, HighPublic

Description

Steps to produce:

  1. Run the code below which is using ellipsis=0 with Arabic text.
  2. Keep on decrementing the window size by dragging the edge of the window once from the left and once from the right.

Issue:
After some iterations, the application crashes.

#include <Elementary.h>


EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   Evas_Object *win;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   win = elm_win_util_standard_add("ellipsis-test", "ellipsis-test");
   elm_win_autodel_set(win, EINA_TRUE);

   evas_object_resize(win, 320, 320);

   Evas_Object *box;
   box = elm_box_add(win);
   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_win_resize_object_add(win, box);
 
   Evas_Object *entry;
   entry = elm_entry_add(box);
   elm_entry_text_style_user_push(entry, "DEFAULT='font_size=40 wrap=word ellipsis=0'");
   //elm_entry_entry_set(entry, "<font='Arial'>Fellow</><font='Sans'> </><font='Arial'>Fellow</>");
   elm_entry_entry_set(entry, "نعم نعم");
   evas_object_resize(entry, 39,67);
   
   elm_entry_cursor_end_set(entry);
   Evas_Textblock_Cursor * cur = evas_object_textblock_cursor_get(elm_entry_textblock_get(entry));
   evas_textblock_cursor_word_start(cur);
   

   evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);

   elm_box_pack_end(box, entry);

   evas_object_show(entry);
   evas_object_show(box);
   evas_object_show(win);

   elm_run();
   return 0;
}
ELM_MAIN()

Sara created this task.Jul 22 2020, 6:18 AM
Sara renamed this task from Application Crashes while using ellipsis=0 with RTL Arabic Language to Application Crashes while using ellipsis=0 with both RTL and LTR Languages.Aug 12 2020, 11:08 PM
Sara added a comment.EditedAug 12 2020, 11:49 PM

The code below will generate the crash as soon as the button is pressed(in RTL):

#include <Elementary.h>
Evas_Object *win;
float w = 99;//(99 for AR)//(96 for EN)
float h = 67;

void
clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
    //dlog_print(DLOG_INFO, LOG_TAG, "Button clicked\n");
    w-=0.1;
    evas_object_resize(win, w, h);
    printf("%f\n", w);
}

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   win = elm_win_util_standard_add("emoji-test", "emoji-test");
   elm_win_autodel_set(win, EINA_TRUE);

   //evas_object_resize(win, 320, 320);
   evas_object_resize(win, w,h);//39,67

   Evas_Object *box;
   box = elm_box_add(win);
   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_win_resize_object_add(win, box);
 
   Evas_Object *entry;
   entry = elm_entry_add(box);
   elm_entry_text_style_user_push(entry, "DEFAULT='font_size=40 wrap=word ellipsis=0'");//ellipsis=0
   elm_entry_entry_set(entry, "نعم نعم"); 
   
   Evas_Object *button;
   button = elm_button_add(box);
   elm_object_style_set(button, "circle");
   elm_object_text_set(button, "Press to resize");
   evas_object_show(button);
   elm_box_pack_end(box, button);
   evas_object_smart_callback_add(button, "clicked", clicked_cb, NULL);//data

   elm_entry_cursor_end_set(entry);
   Evas_Textblock_Cursor * cur = evas_object_textblock_cursor_get(elm_entry_textblock_get(entry));
   //THIS IS THE PROBLEM
   evas_textblock_cursor_word_start(cur);
   

   evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);

   elm_box_pack_end(box, entry);

   evas_object_show(entry);
   evas_object_show(box);
   evas_object_show(win);

   elm_run();
   return 0;
}
ELM_MAIN()
Sara added a comment.Aug 12 2020, 11:51 PM

And in LTR:

#include <Elementary.h>
Evas_Object *win;
float w = 96;//(99 for AR)//(96 for EN)
float h = 67;

void
clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
    //dlog_print(DLOG_INFO, LOG_TAG, "Button clicked\n");
    w-=0.1;
    evas_object_resize(win, w, h);
    printf("%f\n", w);
}

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   win = elm_win_util_standard_add("emoji-test", "emoji-test");
   elm_win_autodel_set(win, EINA_TRUE);

   //evas_object_resize(win, 320, 320);
   evas_object_resize(win, w,h);//39,67

   Evas_Object *box;
   box = elm_box_add(win);
   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_win_resize_object_add(win, box);
 
   Evas_Object *entry;
   entry = elm_entry_add(box);
   elm_entry_text_style_user_push(entry, "DEFAULT='font_size=40 wrap=word ellipsis=0'");//ellipsis=0
   elm_entry_entry_set(entry, "Yes Yes"); 
   
   Evas_Object *button;
   button = elm_button_add(box);
   elm_object_style_set(button, "circle");
   elm_object_text_set(button, "Press to resize");
   evas_object_show(button);
   elm_box_pack_end(box, button);
   evas_object_smart_callback_add(button, "clicked", clicked_cb, NULL);//data

   elm_entry_cursor_end_set(entry);
   Evas_Textblock_Cursor * cur = evas_object_textblock_cursor_get(elm_entry_textblock_get(entry));
   //THIS IS THE PROBLEM
   evas_textblock_cursor_word_start(cur);
   

   evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);

   elm_box_pack_end(box, entry);

   evas_object_show(entry);
   evas_object_show(box);
   evas_object_show(win);

   elm_run();
   return 0;
}
ELM_MAIN()
ProhtMeyhet triaged this task as High priority.