Page MenuHomePhabricator

Elm_code crash with ecrire on close
Closed, InvalidPublic

Description

This happens when you close a document/text file in ecrire.

BT:

(gdb) bt
#0  0x00007f2270686de4 in eina_unicode_utf8_next_get (iindex=0x7ffdbcab5c14, buf=0x7f22666b7000 <error: Cannot access memory at address 0x7f22666b7000>) at ../src/lib/eina/eina_inline_unicode.x:43
#1  0x00007f2270686de4 in _elm_code_widget_line_text_column_width_to_position (obj=0x400000176875, pd=<optimized out>, line=<optimized out>, position=16) at lib/elementary/elm_code_widget_text.c:138
#2  0x00007f2270686f01 in _elm_code_widget_line_text_column_width_get (obj=<optimized out>, pd=<optimized out>, line=<optimized out>) at lib/elementary/elm_code_widget_text.c:157
#3  0x00007f22706819d4 in elm_obj_code_widget_line_text_column_width_get (obj=obj@entry=0x400000176875, line=0x5578984f0d00) at lib/elementary/elm_code_widget.eo.c:172
#4  0x00007f2270684036 in elm_code_widget_line_text_column_width_get (obj=obj@entry=0x400000176875, line=<optimized out>) at lib/elementary/elm_code_widget.eo.c:522
#5  0x00007f2270685481 in _elm_code_widget_resize (widget=widget@entry=0x400000176875, newline=newline@entry=0x0) at lib/elementary/elm_code_widget.c:2037
#6  0x00007f2270685ffc in _elm_code_widget_fill_update (widget=widget@entry=0x400000176875, first_row=1, last_row=12, newline=newline@entry=0x0) at lib/elementary/elm_code_widget.c:512
#7  0x00007f22706860cb in _elm_code_widget_refresh (widget=0x400000176875, line=0x0) at lib/elementary/elm_code_widget.c:551
#8  0x00007f226c4a7797 in _event_callback_call (legacy_compare=1 '\001', event_info=<optimized out>, desc=0x557898328200, pd=0x55789833d0c0, obj_id=<optimized out>) at lib/eo/eo_base_class.c:1698
#9  0x00007f226c4a7797 in _efl_object_event_callback_legacy_call (obj_id=<optimized out>, pd=0x55789833d0c0, desc=0x557898328200, event_info=<optimized out>) at lib/eo/eo_base_class.c:1771
#10 0x00007f226c4a2568 in efl_event_callback_legacy_call (obj=0x400000176875, desc=0x557898328200, event_info=0x0) at lib/eo/eo_base_class.c:1774
#11 0x00007f226c4a2568 in efl_event_callback_legacy_call (obj=0x400000176875, desc=0x557898328200, event_info=0x0) at lib/eo/eo_base_class.c:1774
#12 0x00007f226c4a7d2e in _event_callback_call (legacy_compare=0 '\000', event_info=<optimized out>, desc=0x7f2270929ac0 <_EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED>, pd=0x55789833d0c0, obj_id=<optimized out>)
    at lib/eo/eo_base_class.c:1698
#13 0x00007f226c4a7d2e in _efl_object_event_callback_call (obj_id=<optimized out>, pd=0x55789833d0c0, desc=0x7f2270929ac0 <_EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED>, event_info=<optimized out>)
    at lib/eo/eo_base_class.c:1759
#14 0x00007f226c4a2478 in efl_event_callback_call (obj=0x400000176875, desc=0x7f2270929ac0 <_EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED>, event_info=0x0) at lib/eo/eo_base_class.c:1762
#15 0x00007f226c4a2478 in efl_event_callback_call (obj=0x400000176875, desc=0x7f2270929ac0 <_EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED>, event_info=0x0) at lib/eo/eo_base_class.c:1762
#16 0x00007f227081d6d0 in efl_ui_focus_object_focus_set (obj=0x400000176875, focus=focus@entry=0 '\000') at lib/elementary/efl_ui_focus_object.eo.c:17
#17 0x00007f22707db135 in _efl_ui_widget_efl_ui_focus_object_focus_set (obj=0x400000176875, pd=<optimized out>, focus=<optimized out>) at lib/elementary/efl_ui_widget.c:5696
#18 0x00007f227081d6d0 in efl_ui_focus_object_focus_set (obj=0x400000176875, focus=focus@entry=0 '\000') at lib/elementary/efl_ui_focus_object.eo.c:17
#19 0x00007f2270819ed5 in _efl_ui_focus_manager_calc_unregister (obj=0x400000010edc, pd=0x557897dac420, child=<optimized out>) at lib/elementary/efl_ui_focus_manager_calc.c:762
#20 0x00007f22708187d0 in efl_ui_focus_manager_calc_unregister (obj=0x4000000066b2, child=child@entry=0x400000176875) at lib/elementary/efl_ui_focus_manager_calc.eo.c:42
#21 0x00007f22707cdce9 in _efl_ui_widget_focus_state_apply (obj=0x400000176875, pd=<optimized out>, current_state=..., configured_state=0x7ffdbcab6420, redirect=0x0) at lib/elementary/efl_ui_widget.c:456
#22 0x00007f22707cd3be in efl_ui_widget_focus_state_apply (obj=obj@entry=0x400000176875, current_state=..., configured_state=configured_state@entry=0x7ffdbcab6420, redirect=redirect@entry=0x0)
    at lib/elementary/efl_ui_widget.eo.c:186
#23 0x00007f22707d55c3 in _focus_state_eval (want_full=<optimized out>, should=1 '\001', pd=0x55789833d2d0, obj=0x400000176875) at lib/elementary/efl_ui_widget.c:539
#24 0x00007f22707d55c3 in _full_eval (obj=0x400000176875, pd=0x55789833d2d0) at lib/elementary/efl_ui_widget.c:642
#25 0x00007f226c4a7d2e in _event_callback_call (legacy_compare=0 '\000', event_info=<optimized out>, desc=0x7f2270929ab0 <_EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED>, pd=0x557898330dc0, obj_id=<optimized out>)
    at lib/eo/eo_base_class.c:1698
#26 0x00007f226c4a7d2e in _efl_object_event_callback_call (obj_id=<optimized out>, pd=0x557898330dc0, desc=0x7f2270929ab0 <_EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED>, event_info=<optimized out>)
    at lib/eo/eo_base_class.c:1759
#27 0x00007f226c4a2478 in efl_event_callback_call (obj=0x400000175c72, desc=0x7f2270929ab0 <_EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED>, event_info=0x4000000066b2) at lib/eo/eo_base_class.c:1762
#28 0x00007f226c4a2478 in efl_event_callback_call (obj=obj@entry=0x400000175c72, desc=0x7f2270929ab0 <_EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED>, event_info=event_info@entry=0x4000000066b2)
    at lib/eo/eo_base_class.c:1762
#29 0x00007f22707d562a in _full_eval (obj=0x400000175c72, pd=0x557898330fd0) at lib/elementary/efl_ui_widget.c:652
#30 0x00007f226c4a7d2e in _event_callback_call (legacy_compare=0 '\000', event_info=<optimized out>, desc=0x7f2270929ab0 <_EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED>, pd=0x5578981551f0, obj_id=<optimized out>)
    at lib/eo/eo_base_class.c:1698
#31 0x00007f226c4a7d2e in _efl_object_event_callback_call (obj_id=<optimized out>, pd=0x5578981551f0, desc=0x7f2270929ab0 <_EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED>, event_info=<optimized out>)
    at lib/eo/eo_base_class.c:1759
#32 0x00007f226c4a2478 in efl_event_callback_call (obj=0x400000033f68, desc=0x7f2270929ab0 <_EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED>, event_info=0x4000000066b2) at lib/eo/eo_base_class.c:1762
#33 0x00007f226c4a2478 in efl_event_callback_call (obj=obj@entry=0x400000033f68, desc=0x7f2270929ab0 <_EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED>, event_info=event_info@entry=0x4000000066b2)
    at lib/eo/eo_base_class.c:1762
#34 0x00007f22707d562a in _full_eval (obj=obj@entry=0x400000033f68, pd=pd@entry=0x557898155400) at lib/elementary/efl_ui_widget.c:652
#35 0x00007f22707d59ae in _elm_widget_full_eval_children (obj=obj@entry=0x400000033f68, sd=sd@entry=0x557898155400) at lib/elementary/efl_ui_widget.c:940
#36 0x00007f22707db806 in _efl_ui_widget_efl_gfx_entity_visible_set (obj=0x400000033f68, pd=0x557898155400, vis=0 '\000') at lib/elementary/efl_ui_widget.c:967
#37 0x00007f226c4d5f40 in efl_gfx_entity_visible_set (obj=obj@entry=0x400000033f68, v=v@entry=0 '\000') at ../src/lib/efl/interfaces/efl_gfx_entity.eo.c:15
#38 0x00007f22702b2e8b in _efl_canvas_object_efl_object_invalidate (eo_obj=0x400000033f68, obj=0x557898155240) at lib/evas/canvas/evas_object_main.c:1250
#39 0x00007f226c4a3378 in efl_invalidate (obj=0x400000033f68) at lib/eo/efl_object.eo.c:72
#40 0x00007f226c4a3378 in efl_invalidate (obj=0x400000033f68) at lib/eo/efl_object.eo.c:72
#41 0x00007f226c4a9100 in _efl_invalidate (obj=obj@entry=0x5578981551b0) at lib/eo/eo_base_class.c:171
#42 0x00007f226c4a9968 in _efl_object_parent_set (obj=0x400000033f68, pd=0x5578981551f0, parent_id=0x0) at lib/eo/eo_base_class.c:735
#43 0x00007f226c4a2650 in efl_parent_set (obj=obj@entry=0x400000033f68, parent=parent@entry=0x0) at lib/eo/efl_object.eo.c:12
#44 0x00007f226c4a9a69 in efl_del (obj=0x400000033f68) at lib/eo/eo_base_class.c:687
#45 0x00007f22702b1ee2 in evas_object_del (obj=<optimized out>) at lib/evas/canvas/evas_object_main.c:1043
#46 0x00007f22702c04a6 in _evas_wrap_del (eo=<optimized out>, pd=<optimized out>) at ../src/lib/evas/include/evas_inline.x:362
#47 0x00007f22702c04a6 in _efl_canvas_group_group_members_all_del_internal (o=o@entry=0x557897e69e70) at lib/evas/canvas/evas_object_smart.c:592
#48 0x00007f22702c04f8 in _efl_canvas_group_group_del (eo_obj=<optimized out>, o=0x557897e69e70) at lib/evas/canvas/evas_object_smart.c:823
#49 0x00007f22702bf908 in efl_canvas_group_del (obj=0x400000013ae7) at lib/evas/canvas/evas_object_smart.c:1859
#50 0x00007f22702bf908 in efl_canvas_group_del (obj=obj@entry=0x400000013ae7) at lib/evas/canvas/evas_object_smart.c:1859
#51 0x00007f22702c29e9 in evas_object_smart_del (eo_obj=0x400000013ae7) at lib/evas/canvas/evas_object_smart.c:1293
#52 0x00007f22702b3371 in _efl_canvas_object_efl_object_invalidate (eo_obj=0x400000013ae7, obj=0x557897e69d40) at lib/evas/canvas/evas_object_main.c:1338
#53 0x00007f226c4a3378 in efl_invalidate (obj=0x400000013ae7) at lib/eo/efl_object.eo.c:72
#54 0x00007f226c4a9100 in _efl_invalidate (obj=obj@entry=0x557897e69cb0) at lib/eo/eo_base_class.c:171
#55 0x00007f226c4a9968 in _efl_object_parent_set (obj=0x400000013ae7, pd=0x557897e69cf0, parent_id=0x0) at lib/eo/eo_base_class.c:735
#56 0x00007f226c4a2650 in efl_parent_set (obj=obj@entry=0x400000013ae7, parent=parent@entry=0x0) at lib/eo/efl_object.eo.c:12
#57 0x00007f226c4a9a69 in efl_del (obj=0x400000013ae7) at lib/eo/eo_base_class.c:687
#58 0x00007f22702b1ee2 in evas_object_del (obj=<optimized out>) at lib/evas/canvas/evas_object_main.c:1043
#59 0x00007f22707ebc67 in _efl_ui_win_efl_canvas_group_group_del (obj=0x4000000066b2, sd=0x557897c8bba0) at lib/elementary/efl_ui_win.c:2878
#60 0x00007f22702bf908 in efl_canvas_group_del (obj=obj@entry=0x4000000066b2) at lib/evas/canvas/evas_object_smart.c:1859
#61 0x00007f22702c29e9 in evas_object_smart_del (eo_obj=0x4000000066b2) at lib/evas/canvas/evas_object_smart.c:1293
#62 0x00007f22702b3371 in _efl_canvas_object_efl_object_invalidate (eo_obj=0x4000000066b2, obj=0x557897c8b840) at lib/evas/canvas/evas_object_main.c:1338
#63 0x00007f226c4a3378 in efl_invalidate (obj=0x4000000066b2) at lib/eo/efl_object.eo.c:72
#64 0x00007f226c4a3378 in efl_invalidate (obj=0x4000000066b2) at lib/eo/efl_object.eo.c:72
#65 0x00007f226c4a9100 in _efl_invalidate (obj=obj@entry=0x557897c8b7b0) at lib/eo/eo_base_class.c:171
#66 0x00007f226c4a9968 in _efl_object_parent_set (obj=0x4000000066b2, pd=0x557897c8b7f0, parent_id=0x0) at lib/eo/eo_base_class.c:735
#67 0x00007f226c4a2650 in efl_parent_set (obj=obj@entry=0x4000000066b2, parent=parent@entry=0x0) at lib/eo/efl_object.eo.c:12
#68 0x00007f226c4a9a69 in efl_del (obj=0x4000000066b2) at lib/eo/eo_base_class.c:687
#69 0x00007f22707eea14 in _elm_win_frame_cb_close (data=<optimized out>, obj=<optimized out>, sig=<optimized out>, source=<optimized out>) at lib/elementary/efl_ui_win.c:4357
#70 0x00007f226f53ecb4 in _edje_emit_cb (prop=<optimized out>, data=0x557898277940, src=0x557897ea1680 "elm", sig=0x557897ecaebc "elm,action,close", ed=0x557897ed5120) at lib/edje/edje_program.c:1670
#71 0x00007f226f53ecb4 in _edje_emit_handle (ed=0x557897ed5120, sig=0x557897ecaebc "elm,action,close", src=0x557897ea1680 "elm", sdata=0x557898277940, prop=0 '\000') at lib/edje/edje_program.c:1589
#72 0x00007f226f53909f in _edje_message_queue_process () at lib/edje/edje_message_queue.c:886
#73 0x00007f226f53927a in _edje_message_queue_process () at lib/edje/edje_message_queue.c:852
#74 0x00007f226f53927a in _edje_job (data=<optimized out>) at lib/edje/edje_message_queue.c:260
#75 0x00007f22705211eb in _ecore_job_event_handler (data=<optimized out>, type=<optimized out>, ev=<optimized out>) at lib/ecore/ecore_job.c:98
#76 0x00007f2270526579 in _ecore_event_message_handler_efl_loop_message_handler_message_call (obj=0x40000000169e, pd=0x557897a2e2a0, message=0x4000002d8265) at lib/ecore/ecore_event_message_handler.c:359
#77 0x00007f227052d6e0 in efl_loop_message_handler_message_call (obj=0x40000000169e, message=0x4000002d8265) at lib/ecore/efl_loop_message_handler.eo.c:14
#78 0x00007f227052964a in _efl_loop_message_process (obj=<optimized out>, pd=0x557897a270b0) at lib/ecore/efl_loop.c:633
#79 0x00007f2270528248 in efl_loop_message_process (obj=obj@entry=0x400000000299) at lib/ecore/efl_loop.c:663
#80 0x00007f227052327e in _ecore_main_loop_iterate_internal (obj=obj@entry=0x400000000299, pd=pd@entry=0x557897a270b0, once_only=once_only@entry=0) at lib/ecore/ecore_main.c:2458
#81 0x00007f227052397d in _ecore_main_loop_begin (obj=0x400000000299, pd=pd@entry=0x557897a270b0) at lib/ecore/ecore_main.c:1191
#82 0x00007f227052957a in _efl_loop_begin (obj=<optimized out>, pd=0x557897a270b0) at lib/ecore/efl_loop.c:83
#83 0x00007f22705284f8 in efl_loop_begin (obj=0x400000000299) at lib/ecore/efl_loop.eo.c:28
#84 0x00007f2270523a19 in ecore_main_loop_begin () at lib/ecore/ecore_main.c:1274
#85 0x00005578960d62cf in elm_main ()
#86 0x00005578960d404e in  ()
#87 0x00007f227005d223 in __libc_start_main () at /usr/lib/libc.so.6
#88 0x00005578960d408e in _start ()
ApB created this task.Aug 28 2018, 4:15 AM
netstar closed this task as Invalid.Aug 28 2018, 6:19 AM

Closing:

Try this or something like it:

diff --git a/src/bin/main.c b/src/bin/main.c
index 6cb1805..ec50c73 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -323,7 +323,7 @@ static void
 _close_doc (void *data)
 {
   Ecrire_Doc *doc = data;
-  elm_code_file_close(doc->code->file);
+  elm_code_free(doc->code);
 }
 
 static void
@@ -615,6 +615,7 @@ _win_del_do(void *data)
 {
   Ecrire_Doc *doc = data;
   ecrire_cfg_save();
+  evas_object_del(doc->widget);
   if(_menu)
     evas_object_del(_menu);
   if(_toolbar)
ApB added a comment.Aug 28 2018, 6:48 AM

@netstar is this an ecrire bug?

Looking at this again I think @netstar is right - an elm_code should not close the file if there is an active instance... By destroying the container you close the file correctly.

Closing a file directly can be useful if you are looking to load a different one or otherwise manipulating the elm_code storage.