forked from enlightenment/efl
efl_ui_list_view: Handling failed memory allocation
Summary: Add a logic for handling failed memory allocation to prevent null pointer exception Test Plan: Run unit test cases Reviewers: eagleeye, Jaehyun_Cho, Hermet, zmike, SanghyeonLee Reviewed By: SanghyeonLee Subscribers: SanghyeonLee, cedric, #committers, #reviewers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7829
This commit is contained in:
parent
26caf1641f
commit
9536204023
|
@ -567,6 +567,7 @@ _efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_content_created(Eo
|
|||
}
|
||||
|
||||
cb_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Callback_Data));
|
||||
if (!cb_data) return;
|
||||
cb_data->pd = pd;
|
||||
cb_data->item = item;
|
||||
evas_object_event_callback_add(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data);
|
||||
|
|
|
@ -77,6 +77,7 @@ _alloc_node(Efl_Ui_List_View_Seg_Array* pd, int first)
|
|||
{
|
||||
Efl_Ui_List_View_Seg_Array_Node* node;
|
||||
node = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array_Node) + pd->step_size*sizeof(Efl_Ui_List_View_Layout_Item*));
|
||||
if (!node) return NULL;
|
||||
node->first = first;
|
||||
node->max = pd->step_size;
|
||||
pd->root = (void*)eina_rbtree_inline_insert(EINA_RBTREE_GET(pd->root), EINA_RBTREE_GET(node),
|
||||
|
@ -89,6 +90,7 @@ static Efl_Ui_List_View_Layout_Item*
|
|||
_create_item_partial(Efl_Model* model)
|
||||
{
|
||||
Efl_Ui_List_View_Layout_Item* item = calloc(1, sizeof(Efl_Ui_List_View_Layout_Item));
|
||||
if (!item) return NULL;
|
||||
item->children = efl_ref(model);
|
||||
return item;
|
||||
}
|
||||
|
@ -334,6 +336,7 @@ Efl_Ui_List_View_Seg_Array *
|
|||
efl_ui_list_view_seg_array_setup(int size)
|
||||
{
|
||||
Efl_Ui_List_View_Seg_Array *pd = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array));
|
||||
if (!pd) return NULL;
|
||||
pd->step_size = size;
|
||||
|
||||
return pd;
|
||||
|
|
Loading…
Reference in New Issue