summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Jr <larry.olj@gmail.com>2017-08-18 19:15:10 -0300
committerLarry Jr <larry.olj@gmail.com>2017-08-18 19:15:10 -0300
commitb0f3dcd55836559de758e46b29c1b73753c8fb3f (patch)
tree2de019b828a22820d0c0482010991fabe00a23a4
parent8e2442692ba885a9e65f318e7f93501af7f5e688 (diff)
Elementary: efl_ui_list fixed child transient release crashdevs/felipealmeida/efl_ui_list
-rw-r--r--src/lib/elementary/efl_ui_list.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c
index ba158ed8a8..91d06e88c1 100644
--- a/src/lib/elementary/efl_ui_list.c
+++ b/src/lib/elementary/efl_ui_list.c
@@ -170,7 +170,6 @@ _child_added_cb(void *data, const Efl_Event *event)
170 _insert_at(pd, index, evt->child); 170 _insert_at(pd, index, evt->child);
171 171
172 evas_object_smart_changed(pd->obj); 172 evas_object_smart_changed(pd->obj);
173 _efl_ui_list_custom_layout(pd->obj);
174} 173}
175 174
176static void 175static void
@@ -185,7 +184,6 @@ _child_removed_cb(void *data, const Efl_Event *event)
185 _remove_at(pd, index); 184 _remove_at(pd, index);
186 185
187 evas_object_smart_changed(pd->obj); 186 evas_object_smart_changed(pd->obj);
188 _efl_ui_list_custom_layout(pd->obj);
189} 187}
190 188
191static void 189static void
@@ -406,8 +404,10 @@ _on_item_size_hint_change(void *data, Evas *e EINA_UNUSED,
406 Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 404 Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
407{ 405{
408 Efl_Ui_List_Item *item = data; 406 Efl_Ui_List_Item *item = data;
409 EFL_UI_LIST_DATA_GET_OR_RETURN(item->list, pd); 407 EINA_SAFETY_ON_NULL_RETURN(item);
408// if (obj != item->layout) { printf("NOOOOOOOOOOOOOOOOOOOOOO\n"); return; }
410 409
410 EFL_UI_LIST_DATA_GET_OR_RETURN(item->list, pd);
411 _item_calc(pd, item); 411 _item_calc(pd, item);
412 evas_object_smart_changed(item->list); 412 evas_object_smart_changed(item->list);
413} 413}
@@ -483,9 +483,13 @@ _child_setup(Efl_Ui_List_Data *pd, Efl_Ui_List_Item* item, Efl_Model *model
483 item->layout = *(void**)eina_inarray_pop(recycle_layouts); 483 item->layout = *(void**)eina_inarray_pop(recycle_layouts);
484 else 484 else
485 { 485 {
486 Eina_Stringshare *sselected = eina_stringshare_add("selected");
486 item->layout = efl_ui_factory_create(pd->factory, item->model, pd->obj); 487 item->layout = efl_ui_factory_create(pd->factory, item->model, pd->obj);
487 if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE) 488
489 if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE && _efl_model_properties_has(item->model, sselected))
488 efl_ui_model_connect(item->layout, "signal/elm,state,%v", "selected"); 490 efl_ui_model_connect(item->layout, "signal/elm,state,%v", "selected");
491
492 eina_stringshare_del(sselected);
489 } 493 }
490 item->future = NULL; 494 item->future = NULL;
491 item->index = idx + pd->realized.start; 495 item->index = idx + pd->realized.start;
@@ -511,13 +515,13 @@ _child_setup(Efl_Ui_List_Data *pd, Efl_Ui_List_Item* item, Efl_Model *model
511static void 515static void
512_child_transient_release(Efl_Ui_List_Data* pd, Efl_Ui_List_Item* item) 516_child_transient_release(Efl_Ui_List_Data* pd, Efl_Ui_List_Item* item)
513{ 517{
518 evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, item);
514 efl_event_callback_del(item->model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed_cb, item); 519 efl_event_callback_del(item->model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed_cb, item);
515 evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_MOUSE_DOWN, _on_item_mouse_down, item); 520 evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_MOUSE_DOWN, _on_item_mouse_down, item);
516 evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item); 521 evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item);
517 522
518 efl_event_callback_del(item->layout, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, _on_item_focused, item); 523 efl_event_callback_del(item->layout, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, _on_item_focused, item);
519 524
520 evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, item);
521 if (item->selected) 525 if (item->selected)
522 pd->selected_items = eina_list_remove(pd->selected_items, item); 526 pd->selected_items = eina_list_remove(pd->selected_items, item);
523} 527}
@@ -526,6 +530,7 @@ static void
526_child_release(Efl_Ui_List_Data* pd, Efl_Ui_List_Item* item, Eina_Inarray* recycle_layouts) 530_child_release(Efl_Ui_List_Data* pd, Efl_Ui_List_Item* item, Eina_Inarray* recycle_layouts)
527{ 531{
528 _child_transient_release(pd, item); 532 _child_transient_release(pd, item);
533 item->list = NULL;
529 534
530 _layout_unrealize(pd, item); 535 _layout_unrealize(pd, item);
531 if(item->future) 536 if(item->future)
@@ -542,7 +547,6 @@ _child_release(Efl_Ui_List_Data* pd, Efl_Ui_List_Item* item, Eina_Inarray* recyc
542 pd->realized.w -= item->w; 547 pd->realized.w -= item->w;
543 else 548 else
544 pd->realized.h -= item->h; 549 pd->realized.h -= item->h;
545 item->list = NULL;
546} 550}
547 551
548static void 552static void
@@ -699,11 +703,12 @@ _resize_children(Efl_Ui_List_Data* pd, int removing_before, int removing_after,
699 to_first += to_begin; 703 to_first += to_begin;
700 Efl_Ui_List_Item* from_last = from_first + copy_size; 704 Efl_Ui_List_Item* from_last = from_first + copy_size;
701 Efl_Ui_List_Item* to_last = to_first + copy_size; 705 Efl_Ui_List_Item* to_last = to_first + copy_size;
702 memmove(to_first, from_first, copy_size*sizeof(Efl_Ui_List_Item)); 706 Efl_Ui_List_Item* from_first_t = from_first;
703 for(;from_first != from_last;++from_first) 707 for(;from_first != from_last;++from_first)
704 { 708 {
705 _child_transient_release(pd, from_first); 709 _child_transient_release(pd, from_first);
706 } 710 }
711 memmove(to_first, from_first_t, copy_size*sizeof(Efl_Ui_List_Item));
707 for(;to_first != to_last;++to_first) 712 for(;to_first != to_last;++to_first)
708 { 713 {
709 _child_transient_setup(pd, to_first); 714 _child_transient_setup(pd, to_first);
@@ -802,7 +807,7 @@ _children_then(void * data, Efl_Event const* event)
802 } 807 }
803 808
804 _resize_children(pd, removing_before, removing_after, acc); 809 _resize_children(pd, removing_before, removing_after, acc);
805 _efl_ui_list_custom_layout(pd->obj); 810 evas_object_smart_changed(pd->obj);
806} 811}
807 812
808static void 813static void
@@ -948,7 +953,7 @@ _efl_ui_list_efl_gfx_position_set(Eo *obj, Efl_Ui_List_Data *pd, Evas_Coord x, E
948 953
949 evas_object_move(pd->hit_rect, x, y); 954 evas_object_move(pd->hit_rect, x, y);
950 evas_object_move(pd->pan.obj, x - pd->pan.x, y - pd->pan.y); 955 evas_object_move(pd->pan.obj, x - pd->pan.x, y - pd->pan.y);
951 _efl_ui_list_custom_layout(obj); 956 evas_object_smart_changed(pd->obj);
952} 957}
953 958
954EOLIAN static void 959EOLIAN static void
@@ -982,7 +987,7 @@ _efl_ui_list_efl_gfx_size_set(Eo *obj, Efl_Ui_List_Data *pd, Evas_Coord w, Evas_
982 if (load && _update_items(obj, pd)) 987 if (load && _update_items(obj, pd))
983 return; 988 return;
984 989
985 _efl_ui_list_custom_layout(obj); 990 evas_object_smart_changed(pd->obj);
986} 991}
987 992
988EOLIAN static void 993EOLIAN static void