From db5fe2581d1ab2c4404c413eb24db6fe9d161259 Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Wed, 22 Jan 2014 10:38:55 +0900 Subject: [PATCH] elm: Removed unnecessary null check for evas_object_del. --- legacy/elementary/src/lib/elc_ctxpopup.c | 14 ++++-------- legacy/elementary/src/lib/elc_fileselector.c | 6 ++--- legacy/elementary/src/lib/elc_hoversel.c | 3 +-- legacy/elementary/src/lib/elc_naviframe.c | 8 +++---- legacy/elementary/src/lib/elc_player.c | 3 +-- legacy/elementary/src/lib/elc_popup.c | 18 +++++---------- legacy/elementary/src/lib/elm_bg.c | 6 +---- legacy/elementary/src/lib/elm_clock.c | 14 ++---------- legacy/elementary/src/lib/elm_colorselector.c | 23 ++++++------------- legacy/elementary/src/lib/elm_diskselector.c | 6 ++--- legacy/elementary/src/lib/elm_entry.c | 9 ++++---- legacy/elementary/src/lib/elm_factory.c | 2 +- legacy/elementary/src/lib/elm_flip.c | 2 +- legacy/elementary/src/lib/elm_genlist.c | 11 +++------ legacy/elementary/src/lib/elm_hover.c | 8 +------ legacy/elementary/src/lib/elm_icon.c | 6 ++--- legacy/elementary/src/lib/elm_image.c | 2 +- legacy/elementary/src/lib/elm_index.c | 21 ++++++----------- .../elementary/src/lib/elm_interface_scrollable.c | 6 +---- legacy/elementary/src/lib/elm_list.c | 6 +---- legacy/elementary/src/lib/elm_map.c | 26 +++++++++++----------- legacy/elementary/src/lib/elm_mapbuf.c | 2 +- legacy/elementary/src/lib/elm_menu.c | 7 +++--- legacy/elementary/src/lib/elm_notify.c | 2 +- legacy/elementary/src/lib/elm_photocam.c | 9 ++------ legacy/elementary/src/lib/elm_prefs.c | 10 ++++----- legacy/elementary/src/lib/elm_scroller.c | 2 +- legacy/elementary/src/lib/elm_segment_control.c | 2 +- legacy/elementary/src/lib/elm_slideshow.c | 3 +-- legacy/elementary/src/lib/elm_thumb.c | 3 +-- legacy/elementary/src/lib/elm_toolbar.c | 23 +++++++------------ legacy/elementary/src/lib/elm_widget.c | 3 +-- legacy/elementary/src/lib/elm_win.c | 18 +++++---------- legacy/elementary/src/lib/els_cursor.c | 12 +++------- legacy/elementary/src/lib/els_tooltip.c | 3 +-- 35 files changed, 98 insertions(+), 201 deletions(-) diff --git a/legacy/elementary/src/lib/elc_ctxpopup.c b/legacy/elementary/src/lib/elc_ctxpopup.c index 4900765..ee756f6 100644 --- a/legacy/elementary/src/lib/elc_ctxpopup.c +++ b/legacy/elementary/src/lib/elc_ctxpopup.c @@ -786,7 +786,7 @@ _elm_ctxpopup_smart_content_set(Eo *obj, void *_pd, va_list *list) if (content == sd->content) goto end; - if (sd->content) evas_object_del(sd->content); + evas_object_del(sd->content); if (sd->content == sd->list) sd->list = NULL; evas_object_size_hint_weight_set @@ -1040,10 +1040,7 @@ _list_resize_cb(void *data, static void _list_del(Elm_Ctxpopup_Smart_Data *sd) { - if (!sd->list) return; - - evas_object_del(sd->list); - sd->list = NULL; + ELM_SAFE_FREE(sd->list, evas_object_del); } static Eina_Bool @@ -1158,11 +1155,8 @@ _elm_ctxpopup_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) _parent_detach(obj); elm_ctxpopup_clear(obj); - evas_object_del(sd->arrow); - sd->arrow = NULL; /* stops _sizing_eval() from going on on deletion */ - - evas_object_del(sd->bg); - sd->bg = NULL; + ELM_SAFE_FREE(sd->arrow, evas_object_del); /* stops _sizing_eval() from going on on deletion */ + ELM_SAFE_FREE(sd->bg, evas_object_del); EINA_LIST_FREE(sd->items, it) elm_widget_item_free(it); diff --git a/legacy/elementary/src/lib/elc_fileselector.c b/legacy/elementary/src/lib/elc_fileselector.c index 49bfbd3..dcd9ad7 100644 --- a/legacy/elementary/src/lib/elc_fileselector.c +++ b/legacy/elementary/src/lib/elc_fileselector.c @@ -1583,10 +1583,8 @@ _buttons_ok_cancel_set(Eo *obj, void *_pd, va_list *list) } else if (!visible) { - evas_object_del(sd->cancel_button); - sd->cancel_button = NULL; - evas_object_del(sd->ok_button); - sd->ok_button = NULL; + ELM_SAFE_FREE(sd->cancel_button, evas_object_del); + ELM_SAFE_FREE(sd->ok_button, evas_object_del); } } diff --git a/legacy/elementary/src/lib/elc_hoversel.c b/legacy/elementary/src/lib/elc_hoversel.c index a472122..d0321a9 100644 --- a/legacy/elementary/src/lib/elc_hoversel.c +++ b/legacy/elementary/src/lib/elc_hoversel.c @@ -449,8 +449,7 @@ _hover_end(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { VIEW(it) = NULL; } - evas_object_del(sd->hover); - sd->hover = NULL; + ELM_SAFE_FREE(sd->hover, evas_object_del); evas_object_smart_callback_call(obj, SIG_DISMISSED, NULL); } diff --git a/legacy/elementary/src/lib/elc_naviframe.c b/legacy/elementary/src/lib/elc_naviframe.c index 6143f2a..7441a02 100644 --- a/legacy/elementary/src/lib/elc_naviframe.c +++ b/legacy/elementary/src/lib/elc_naviframe.c @@ -548,7 +548,7 @@ _item_content_set(Elm_Naviframe_Item *it, { if (it->content == content) return; - if (it->content) evas_object_del(it->content); + evas_object_del(it->content); it->content = content; if (!content) return; @@ -565,7 +565,7 @@ _item_title_prev_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn) { if (it->title_prev_btn == btn) return; - if (it->title_prev_btn) evas_object_del(it->title_prev_btn); + evas_object_del(it->title_prev_btn); it->title_prev_btn = btn; if (!btn) return; @@ -582,7 +582,7 @@ _item_title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn) { if (it->title_next_btn == btn) return; - if (it->title_next_btn) evas_object_del(it->title_next_btn); + evas_object_del(it->title_next_btn); it->title_next_btn = btn; if (!btn) return; @@ -598,7 +598,7 @@ _item_title_icon_set(Elm_Naviframe_Item *it, Evas_Object *icon) { if (it->title_icon == icon) return; - if (it->title_icon) evas_object_del(it->title_icon); + evas_object_del(it->title_icon); it->title_icon = icon; if (!icon) return; diff --git a/legacy/elementary/src/lib/elc_player.c b/legacy/elementary/src/lib/elc_player.c index 0d39dfa..2b6eff3 100644 --- a/legacy/elementary/src/lib/elc_player.c +++ b/legacy/elementary/src/lib/elc_player.c @@ -563,8 +563,7 @@ _elm_player_smart_content_set(Eo *obj, void *_pd, va_list *list) if (!_elm_video_check(content)) return; if (sd->video == content) goto end; - if (sd->video) evas_object_del(sd->video); - + evas_object_del(sd->video); sd->video = content; if (!content) goto end; diff --git a/legacy/elementary/src/lib/elc_popup.c b/legacy/elementary/src/lib/elc_popup.c index 6573472..640134c 100644 --- a/legacy/elementary/src/lib/elc_popup.c +++ b/legacy/elementary/src/lib/elc_popup.c @@ -188,11 +188,10 @@ _list_del(Elm_Popup_Smart_Data *sd) evas_object_event_callback_del (sd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb); - evas_object_del(sd->tbl); + ELM_SAFE_FREE(sd->tbl, evas_object_del); sd->scr = NULL; sd->box = NULL; sd->spacer = NULL; - sd->tbl = NULL; } static void @@ -229,8 +228,7 @@ _elm_popup_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) if (sd->buttons[i]) { evas_object_del(sd->buttons[i]->btn); - free(sd->buttons[i]); - sd->buttons[i] = NULL; + ELM_SAFE_FREE(sd->buttons[i], free); } } if (sd->items) @@ -580,8 +578,7 @@ _button_remove(Evas_Object *obj, if (!sd->last_button_number) { _visuals_set(obj); - evas_object_del(sd->action_area); - sd->action_area = NULL; + ELM_SAFE_FREE(sd->action_area, evas_object_del); edje_object_message_signal_process(wd->resize_obj); } else @@ -728,9 +725,7 @@ _item_icon_set(Elm_Popup_Item *it, { if (it->icon == icon) return; - if (it->icon) - evas_object_del(it->icon); - + evas_object_del(it->icon); it->icon = icon; if (it->icon) { @@ -1046,7 +1041,7 @@ _title_icon_set(Evas_Object *obj, if (sd->title_icon == icon) return EINA_TRUE; title_visibility_old = (sd->title_text) || (sd->title_icon); - if (sd->title_icon) evas_object_del(sd->title_icon); + evas_object_del(sd->title_icon); sd->title_icon = icon; title_visibility_current = (sd->title_text) || (sd->title_icon); @@ -1912,8 +1907,7 @@ _item_append(Eo *obj, void *_pd, va_list *list) { prev_content = elm_layout_content_get (sd->content_area, CONTENT_PART); - if (prev_content) - evas_object_del(prev_content); + evas_object_del(prev_content); } //The first item is appended. diff --git a/legacy/elementary/src/lib/elm_bg.c b/legacy/elementary/src/lib/elm_bg.c index 3c40451..ef8792d 100644 --- a/legacy/elementary/src/lib/elm_bg.c +++ b/legacy/elementary/src/lib/elm_bg.c @@ -177,11 +177,7 @@ _file_set(Eo *obj, void *_pd, va_list *list) const char *p; Eina_Bool int_ret; - if (sd->img) - { - evas_object_del(sd->img); - sd->img = NULL; - } + ELM_SAFE_FREE(sd->img, evas_object_del); if (!file) { ELM_SAFE_FREE(sd->file, eina_stringshare_del); diff --git a/legacy/elementary/src/lib/elm_clock.c b/legacy/elementary/src/lib/elm_clock.c index 51b2b4f..c63c7e0 100644 --- a/legacy/elementary/src/lib/elm_clock.c +++ b/legacy/elementary/src/lib/elm_clock.c @@ -352,18 +352,8 @@ _time_update(Evas_Object *obj) Evas_Coord mw, mh; for (i = 0; i < 6; i++) - { - if (sd->digit[i]) - { - evas_object_del(sd->digit[i]); - sd->digit[i] = NULL; - } - } - if (sd->am_pm_obj) - { - evas_object_del(sd->am_pm_obj); - sd->am_pm_obj = NULL; - } + ELM_SAFE_FREE(sd->digit[i], evas_object_del); + ELM_SAFE_FREE(sd->am_pm_obj, evas_object_del); if ((sd->seconds) && (sd->am_pm)) { diff --git a/legacy/elementary/src/lib/elm_colorselector.c b/legacy/elementary/src/lib/elm_colorselector.c index bdd7f51..9efb495 100644 --- a/legacy/elementary/src/lib/elm_colorselector.c +++ b/legacy/elementary/src/lib/elm_colorselector.c @@ -1113,23 +1113,14 @@ _elm_colorselector_smart_theme(Eo *obj, void *_pd, va_list *list) { if (sd->cb_data[i]) { - evas_object_del(sd->cb_data[i]->colorbar); - sd->cb_data[i]->colorbar = NULL; - evas_object_del(sd->cb_data[i]->bar); - sd->cb_data[i]->bar = NULL; - evas_object_del(sd->cb_data[i]->lbt); - sd->cb_data[i]->lbt = NULL; - evas_object_del(sd->cb_data[i]->rbt); - sd->cb_data[i]->rbt = NULL; + ELM_SAFE_FREE(sd->cb_data[i]->colorbar, evas_object_del); + ELM_SAFE_FREE(sd->cb_data[i]->bar, evas_object_del); + ELM_SAFE_FREE(sd->cb_data[i]->lbt, evas_object_del); + ELM_SAFE_FREE(sd->cb_data[i]->rbt, evas_object_del); if (i != 0) - { - evas_object_del(sd->cb_data[i]->bg_rect); - sd->cb_data[i]->bg_rect = NULL; - } - evas_object_del(sd->cb_data[i]->arrow); - sd->cb_data[i]->arrow = NULL; - evas_object_del(sd->cb_data[i]->touch_area); - sd->cb_data[i]->touch_area = NULL; + ELM_SAFE_FREE(sd->cb_data[i]->bg_rect, evas_object_del); + ELM_SAFE_FREE(sd->cb_data[i]->arrow, evas_object_del); + ELM_SAFE_FREE(sd->cb_data[i]->touch_area, evas_object_del); } } diff --git a/legacy/elementary/src/lib/elm_diskselector.c b/legacy/elementary/src/lib/elm_diskselector.c index 077ef43..04b41b1 100644 --- a/legacy/elementary/src/lib/elm_diskselector.c +++ b/legacy/elementary/src/lib/elm_diskselector.c @@ -333,9 +333,7 @@ _item_del(Elm_Diskselector_Item *item) ELM_DISKSELECTOR_DATA_GET(WIDGET(item), sd); sd->item_count -= 1; eina_stringshare_del(item->label); - - if (item->icon) - evas_object_del(item->icon); + evas_object_del(item->icon); } static void @@ -488,7 +486,7 @@ _item_icon_set(Elm_Diskselector_Item *it, { if (it->icon == icon) return; - if (it->icon) evas_object_del(it->icon); + evas_object_del(it->icon); it->icon = icon; if (VIEW(it)) diff --git a/legacy/elementary/src/lib/elm_entry.c b/legacy/elementary/src/lib/elm_entry.c index c8774c9..0ce8cf3 100644 --- a/legacy/elementary/src/lib/elm_entry.c +++ b/legacy/elementary/src/lib/elm_entry.c @@ -1419,9 +1419,9 @@ _magnifier_create(void *data) Evas *e; Evas_Coord w, h, mw, mh; - if (sd->mgf_proxy) evas_object_del(sd->mgf_proxy); - if (sd->mgf_bg) evas_object_del(sd->mgf_bg); - if (sd->mgf_clip) evas_object_del(sd->mgf_clip); + evas_object_del(sd->mgf_proxy); + evas_object_del(sd->mgf_bg); + evas_object_del(sd->mgf_clip); e = evas_object_evas_get(data); @@ -2124,8 +2124,7 @@ _entry_hover_anchor_clicked_do(Evas_Object *obj, !elm_layout_content_get(sd->anchor_hover.hover, "top") && !elm_layout_content_get(sd->anchor_hover.hover, "bottom")) { - evas_object_del(sd->anchor_hover.hover); - sd->anchor_hover.hover = NULL; + ELM_SAFE_FREE(sd->anchor_hover.hover, evas_object_del); } else evas_object_show(sd->anchor_hover.hover); diff --git a/legacy/elementary/src/lib/elm_factory.c b/legacy/elementary/src/lib/elm_factory.c index bb25f62..212f512 100644 --- a/legacy/elementary/src/lib/elm_factory.c +++ b/legacy/elementary/src/lib/elm_factory.c @@ -253,7 +253,7 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) if (wd->content == content) return; prev_content = _content_unset_hook(obj, part); - if (prev_content) evas_object_del(prev_content); + evas_object_del(prev_content); wd->content = content; if (!content) return; diff --git a/legacy/elementary/src/lib/elm_flip.c b/legacy/elementary/src/lib/elm_flip.c index f108737..f47442f 100644 --- a/legacy/elementary/src/lib/elm_flip.c +++ b/legacy/elementary/src/lib/elm_flip.c @@ -1749,7 +1749,7 @@ _flip_content_set(Evas_Object *obj, if (*cont == content) return EINA_TRUE; - if (*cont) evas_object_del(*cont); + evas_object_del(*cont); *cont = content; if (content) diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index a82454e..925671a 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -1293,8 +1293,7 @@ _item_cache_add(Elm_Gen_Item *it) evas_event_freeze(evas_object_evas_get(obj)); if (sd->item_cache_max <= 0) { - evas_object_del(VIEW(it)); - VIEW(it) = NULL; + ELM_SAFE_FREE(VIEW(it), evas_object_del); ELM_SAFE_FREE(it->spacer, evas_object_del); evas_event_thaw(evas_object_evas_get(obj)); @@ -4472,8 +4471,7 @@ _item_unrealize_cb(Elm_Gen_Item *it) if (it->item->nocache_once || it->item->nocache) { - evas_object_del(VIEW(it)); - VIEW(it) = NULL; + ELM_SAFE_FREE(VIEW(it), evas_object_del); ELM_SAFE_FREE(it->spacer, evas_object_del); } else @@ -4988,10 +4986,7 @@ _elm_genlist_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) sd->queue = eina_list_free(sd->queue); elm_genlist_clear(obj); for (i = 0; i < 2; i++) - { - evas_object_del(sd->stack[i]); - sd->stack[i] = NULL; - } + ELM_SAFE_FREE(sd->stack[i], evas_object_del); eo_unref(sd->pan_obj); ELM_SAFE_FREE(sd->pan_obj, evas_object_del); diff --git a/legacy/elementary/src/lib/elm_hover.c b/legacy/elementary/src/lib/elm_hover.c index 48a95a1..ca41279 100644 --- a/legacy/elementary/src/lib/elm_hover.c +++ b/legacy/elementary/src/lib/elm_hover.c @@ -398,13 +398,7 @@ static void _elm_hover_subs_del(Elm_Hover_Smart_Data *sd) { ELM_HOVER_PARTS_FOREACH - { - if (sd->subs[i].obj) - { - evas_object_del(sd->subs[i].obj); - sd->subs[i].obj = NULL; - } - } + ELM_SAFE_FREE(sd->subs[i].obj, evas_object_del); } static void diff --git a/legacy/elementary/src/lib/elm_icon.c b/legacy/elementary/src/lib/elm_icon.c index 6136e83..533de87 100644 --- a/legacy/elementary/src/lib/elm_icon.c +++ b/legacy/elementary/src/lib/elm_icon.c @@ -381,14 +381,12 @@ _elm_icon_smart_file_set(Eo *obj, void *_pd, va_list *list) /* parent's edje file setting path replicated here (we got .eet * extension, so bypassing it) */ - if (id->prev_img) - evas_object_del(id->prev_img); - id->prev_img = NULL; + ELM_SAFE_FREE(id->prev_img, evas_object_del); if (!id->edje) { pclip = evas_object_clip_get(id->img); - if (id->img) evas_object_del(id->img); + evas_object_del(id->img); /* Edje object instead */ id->img = edje_object_add(evas_object_evas_get(obj)); diff --git a/legacy/elementary/src/lib/elm_image.c b/legacy/elementary/src/lib/elm_image.c index dd68e83..cb0e27b 100644 --- a/legacy/elementary/src/lib/elm_image.c +++ b/legacy/elementary/src/lib/elm_image.c @@ -204,7 +204,7 @@ _elm_image_edje_file_set(Evas_Object *obj, if (!sd->edje) { pclip = evas_object_clip_get(sd->img); - if (sd->img) evas_object_del(sd->img); + evas_object_del(sd->img); /* Edje object instead */ sd->img = edje_object_add(evas_object_evas_get(obj)); diff --git a/legacy/elementary/src/lib/elm_index.c b/legacy/elementary/src/lib/elm_index.c index eaaa510..5b9597e 100644 --- a/legacy/elementary/src/lib/elm_index.c +++ b/legacy/elementary/src/lib/elm_index.c @@ -81,11 +81,8 @@ _index_box_clear(Evas_Object *obj, EINA_LIST_FOREACH(sd->items, l, it) { - if (!VIEW(it)) continue; if (it->level != level) continue; - - evas_object_del(VIEW(it)); - VIEW(it) = NULL; + ELM_SAFE_FREE(VIEW(it), evas_object_del); } sd->level_active[level] = EINA_FALSE; @@ -362,11 +359,9 @@ _elm_index_smart_theme(Eo *obj, void *_pd, va_list *list) } elm_layout_content_set(obj, "elm.swallow.index.1", sd->bx[1]); } - else if (sd->bx[1]) - { - evas_object_del(sd->bx[1]); - sd->bx[1] = NULL; - } + else + ELM_SAFE_FREE(sd->bx[1], evas_object_del); + if (edje_object_part_exists (wd->resize_obj, "elm.swallow.event.1")) { @@ -380,11 +375,9 @@ _elm_index_smart_theme(Eo *obj, void *_pd, va_list *list) elm_layout_content_set(obj, "elm.swallow.event.1", sd->event_rect[1]); evas_object_size_hint_min_set(sd->event_rect[1], minw, minh); } - else if (sd->event_rect[1]) - { - evas_object_del(sd->event_rect[1]); - sd->event_rect[1] = NULL; - } + else + ELM_SAFE_FREE(sd->event_rect[1], evas_object_del); + edje_object_message_signal_process(wd->resize_obj); elm_layout_sizing_eval(obj); diff --git a/legacy/elementary/src/lib/elm_interface_scrollable.c b/legacy/elementary/src/lib/elm_interface_scrollable.c index 0f168d7..1ba0980 100644 --- a/legacy/elementary/src/lib/elm_interface_scrollable.c +++ b/legacy/elementary/src/lib/elm_interface_scrollable.c @@ -3845,11 +3845,7 @@ _elm_scroll_extern_pan_set(Eo *obj, void *_pd, va_list *list) } else { - if (sid->pan_obj) - { - evas_object_del(sid->pan_obj); - sid->pan_obj = NULL; - } + ELM_SAFE_FREE(sid->pan_obj, evas_object_del); } if (!pan) { diff --git a/legacy/elementary/src/lib/elm_list.c b/legacy/elementary/src/lib/elm_list.c index 8ca8825..13fd480 100644 --- a/legacy/elementary/src/lib/elm_list.c +++ b/legacy/elementary/src/lib/elm_list.c @@ -1396,11 +1396,7 @@ _item_content_set_hook(Elm_Object_Item *it, evas_object_rectangle_add(evas_object_evas_get(WIDGET(item))); evas_object_color_set(content, 0, 0, 0, 0); } - if (*icon_p) - { - evas_object_del(*icon_p); - *icon_p = NULL; - } + evas_object_del(*icon_p); *icon_p = content; if (VIEW(item)) diff --git a/legacy/elementary/src/lib/elm_map.c b/legacy/elementary/src/lib/elm_map.c index 8e681d4..b854982 100644 --- a/legacy/elementary/src/lib/elm_map.c +++ b/legacy/elementary/src/lib/elm_map.c @@ -1505,7 +1505,7 @@ _overlay_default_content_update(Overlay_Default *ovl, EINA_SAFETY_ON_NULL_RETURN(ovl); if (ovl->content == content) return; - if (ovl->content) evas_object_del(ovl->content); + evas_object_del(ovl->content); ovl->content = content; if (ovl->content) @@ -1555,7 +1555,7 @@ _overlay_default_class_content_update(Overlay_Default *ovl, { EINA_SAFETY_ON_NULL_RETURN(ovl); - if (ovl->clas_content) evas_object_del(ovl->clas_content); + evas_object_del(ovl->clas_content); ovl->clas_content = _icon_dup(content, ovl->layout); _overlay_default_layout_update(ovl); } @@ -1568,7 +1568,7 @@ _overlay_default_icon_update(Overlay_Default *ovl, if (ovl->icon == icon) return; - if (ovl->icon) evas_object_del(ovl->icon); + evas_object_del(ovl->icon); ovl->icon = icon; _overlay_default_layout_update(ovl); } @@ -1579,7 +1579,7 @@ _overlay_default_class_icon_update(Overlay_Default *ovl, { EINA_SAFETY_ON_NULL_RETURN(ovl); - if (ovl->clas_icon) evas_object_del(ovl->clas_icon); + evas_object_del(ovl->clas_icon); ovl->clas_icon = _icon_dup(icon, ovl->layout); _overlay_default_layout_update(ovl); } @@ -1599,11 +1599,11 @@ _overlay_default_free(Overlay_Default *ovl) { EINA_SAFETY_ON_NULL_RETURN(ovl); - if (ovl->content) evas_object_del(ovl->content); - if (ovl->icon) evas_object_del(ovl->icon); - if (ovl->clas_content) evas_object_del(ovl->clas_content); - if (ovl->clas_icon) evas_object_del(ovl->clas_icon); - if (ovl->layout) evas_object_del(ovl->layout); + evas_object_del(ovl->content); + evas_object_del(ovl->icon); + evas_object_del(ovl->clas_content); + evas_object_del(ovl->clas_icon); + evas_object_del(ovl->layout); free(ovl); } @@ -1777,7 +1777,7 @@ _overlay_class_icon_update(Overlay_Class *ovl, EINA_SAFETY_ON_NULL_RETURN(ovl); if (ovl->icon == icon) return; - if (ovl->icon) evas_object_del(ovl->icon); + evas_object_del(ovl->icon); ovl->icon = icon; // For using proxy, it should have size and be shown but moved away to hide. evas_object_resize(icon, 32, 32); @@ -1804,7 +1804,7 @@ _overlay_class_content_update(Overlay_Class *ovl, EINA_SAFETY_ON_NULL_RETURN(ovl); if (ovl->content == content) return; - if (ovl->content) evas_object_del(ovl->content); + evas_object_del(ovl->content); ovl->content = content; // For using proxy, it should have size and be shown but moved away to hide. // content should have it's own size @@ -1855,8 +1855,8 @@ _overlay_class_free(Overlay_Class *clas) _overlay_default_class_icon_update(overlay->ovl, NULL); } } - if (clas->icon) evas_object_del(clas->icon); - if (clas->members) eina_list_free(clas->members); + evas_object_del(clas->icon); + eina_list_free(clas->members); free(clas); } diff --git a/legacy/elementary/src/lib/elm_mapbuf.c b/legacy/elementary/src/lib/elm_mapbuf.c index 7403db8..3aff346 100644 --- a/legacy/elementary/src/lib/elm_mapbuf.c +++ b/legacy/elementary/src/lib/elm_mapbuf.c @@ -220,7 +220,7 @@ _elm_mapbuf_smart_content_set(Eo *obj, void *_pd, va_list *list) return; } - if (sd->content) evas_object_del(sd->content); + evas_object_del(sd->content); sd->content = content; if (content) diff --git a/legacy/elementary/src/lib/elm_menu.c b/legacy/elementary/src/lib/elm_menu.c index 7fa0d20..f41b75c 100644 --- a/legacy/elementary/src/lib/elm_menu.c +++ b/legacy/elementary/src/lib/elm_menu.c @@ -305,8 +305,7 @@ _item_content_set_hook(Elm_Object_Item *it, item = (Elm_Menu_Item *)it; if (content == item->content) return; - if (item->content) evas_object_del(item->content); - + evas_object_del(item->content); item->content = content; if (item->content) elm_layout_content_set(VIEW(item), "elm.swallow.content", item->content); @@ -634,8 +633,8 @@ _elm_menu_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) evas_object_event_callback_del_full (sd->bx, EVAS_CALLBACK_RESIZE, _menu_resize_cb, obj); - if (sd->hv) evas_object_del(sd->hv); - if (sd->location) evas_object_del(sd->location); + evas_object_del(sd->hv); + evas_object_del(sd->location); eo_do_super(obj, MY_CLASS, evas_obj_smart_del()); } diff --git a/legacy/elementary/src/lib/elm_notify.c b/legacy/elementary/src/lib/elm_notify.c index def1d6c..c03adb4 100644 --- a/legacy/elementary/src/lib/elm_notify.c +++ b/legacy/elementary/src/lib/elm_notify.c @@ -405,7 +405,7 @@ _elm_notify_smart_content_set(Eo *obj, void *_pd, va_list *list) if (part && strcmp(part, "default")) return; if (sd->content == content) goto end; - if (sd->content) evas_object_del(sd->content); + evas_object_del(sd->content); sd->content = content; if (content) diff --git a/legacy/elementary/src/lib/elm_photocam.c b/legacy/elementary/src/lib/elm_photocam.c index 661e183..cdc1a8b 100644 --- a/legacy/elementary/src/lib/elm_photocam.c +++ b/legacy/elementary/src/lib/elm_photocam.c @@ -1408,8 +1408,7 @@ _elm_photocam_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) free(g); } eo_unref(sd->pan_obj); - evas_object_del(sd->pan_obj); - sd->pan_obj = NULL; + ELM_SAFE_FREE(sd->pan_obj, evas_object_del); if (sd->f) eina_file_close(sd->f); free(sd->remote_data); @@ -2262,11 +2261,7 @@ _gesture_enabled_set(Eo *obj, void *_pd, va_list *list) sd->do_gesture = gesture; - if (sd->g_layer) - { - evas_object_del(sd->g_layer); - sd->g_layer = NULL; - } + ELM_SAFE_FREE(sd->g_layer, evas_object_del); if (!gesture) return; diff --git a/legacy/elementary/src/lib/elm_prefs.c b/legacy/elementary/src/lib/elm_prefs.c index 443b49e..ff487e0 100644 --- a/legacy/elementary/src/lib/elm_prefs.c +++ b/legacy/elementary/src/lib/elm_prefs.c @@ -1034,13 +1034,11 @@ _elm_prefs_page_populate(Elm_Prefs_Page_Node *page, err: EINA_LIST_FOREACH(page->items, l, it) { - if (it->w_obj) evas_object_del(it->w_obj); - it->w_obj = NULL; + ELM_SAFE_FREE(it->w_obj, evas_object_del); it->w_impl = NULL; } - if (page->w_obj) evas_object_del(page->w_obj); - page->w_obj = NULL; + ELM_SAFE_FREE(page->w_obj, evas_object_del); page->w_impl = NULL; return EINA_FALSE; @@ -2084,10 +2082,10 @@ _prefs_item_del_cb(void *data EINA_UNUSED, it = evas_object_data_get(obj, "prefs_item"); lbl = evas_object_data_del(it->w_obj, "label_widget"); - if (lbl) evas_object_del(lbl); + evas_object_del(lbl); icon = evas_object_data_del(it->w_obj, "icon_widget"); - if (icon) evas_object_del(icon); + evas_object_del(icon); ELM_PREFS_DATA_GET(it->prefs, sd); diff --git a/legacy/elementary/src/lib/elm_scroller.c b/legacy/elementary/src/lib/elm_scroller.c index 0391bff..00d61f9 100644 --- a/legacy/elementary/src/lib/elm_scroller.c +++ b/legacy/elementary/src/lib/elm_scroller.c @@ -654,7 +654,7 @@ _elm_scroller_smart_content_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list) if (sd->content == content) return; - if (sd->content) evas_object_del(sd->content); + evas_object_del(sd->content); sd->content = content; if (content) diff --git a/legacy/elementary/src/lib/elm_segment_control.c b/legacy/elementary/src/lib/elm_segment_control.c index b2f79c6..2d46089 100644 --- a/legacy/elementary/src/lib/elm_segment_control.c +++ b/legacy/elementary/src/lib/elm_segment_control.c @@ -460,7 +460,7 @@ _item_content_set_hook(Elm_Object_Item *it, { if (content == item->icon) return; - if (item->icon) evas_object_del(item->icon); + evas_object_del(item->icon); item->icon = content; if (!item->icon) { diff --git a/legacy/elementary/src/lib/elm_slideshow.c b/legacy/elementary/src/lib/elm_slideshow.c index dcdf5f5..746f1de 100644 --- a/legacy/elementary/src/lib/elm_slideshow.c +++ b/legacy/elementary/src/lib/elm_slideshow.c @@ -223,8 +223,7 @@ _item_realize(Elm_Slideshow_Item *item) (sd->items_built, sd->items_built); if (item->itc->func.del) item->itc->func.del(elm_widget_item_data_get(item), VIEW(item)); - evas_object_del(VIEW(item)); - VIEW(item) = NULL; + ELM_SAFE_FREE(VIEW(item), evas_object_del); } } diff --git a/legacy/elementary/src/lib/elm_thumb.c b/legacy/elementary/src/lib/elm_thumb.c index 3119b0e..6b00582 100644 --- a/legacy/elementary/src/lib/elm_thumb.c +++ b/legacy/elementary/src/lib/elm_thumb.c @@ -206,8 +206,7 @@ _thumb_finish(Elm_Thumb_Smart_Data *sd, evas = evas_object_evas_get(sd->obj); if ((sd->view) && (sd->is_video ^ sd->was_video)) { - evas_object_del(sd->view); - sd->view = NULL; + ELM_SAFE_FREE(sd->view, evas_object_del); } sd->was_video = sd->is_video; diff --git a/legacy/elementary/src/lib/elm_toolbar.c b/legacy/elementary/src/lib/elm_toolbar.c index 8c37d3b..dc49542 100644 --- a/legacy/elementary/src/lib/elm_toolbar.c +++ b/legacy/elementary/src/lib/elm_toolbar.c @@ -121,11 +121,7 @@ _items_visibility_fix(Elm_Toolbar_Smart_Data *sd, static void _item_menu_destroy(Elm_Toolbar_Item *item) { - if (item->o_menu) - { - evas_object_del(item->o_menu); - item->o_menu = NULL; - } + ELM_SAFE_FREE(item->o_menu, evas_object_del); item->menu = EINA_FALSE; } @@ -934,10 +930,10 @@ _item_del(Elm_Toolbar_Item *it) evas_object_del(it->icon); } - if (it->object) evas_object_del(it->object); + evas_object_del(it->object); //TODO: See if checking for sd->menu_parent is necessary before //deleting menu - if (it->o_menu) evas_object_del(it->o_menu); + evas_object_del(it->o_menu); } static void @@ -1346,7 +1342,7 @@ _item_content_set_hook(Elm_Object_Item *it, if (part && strcmp(part, "object")) return; if (item->object == content) return; - if (item->object) evas_object_del(item->object); + evas_object_del(item->object); item->object = content; if (item->object) @@ -1574,8 +1570,7 @@ _transit_del_cb(void *data, Elm_Transit *transit EINA_UNUSED) if (item->proxy) { evas_object_image_source_visible_set(elm_image_object_get(item->proxy), EINA_TRUE); - evas_object_del(item->proxy); - item->proxy = NULL; + ELM_SAFE_FREE(item->proxy, evas_object_del); } item->trans = NULL; @@ -1759,8 +1754,7 @@ _mouse_up_reorder(Elm_Toolbar_Item *it, if (it->proxy) { evas_object_image_source_visible_set(elm_image_object_get(it->proxy), EINA_TRUE); - evas_object_del(it->proxy); - it->proxy = NULL; + ELM_SAFE_FREE(it->proxy, evas_object_del); } eo_do(obj, elm_scrollable_interface_hold_set(EINA_FALSE)); @@ -3557,8 +3551,7 @@ elm_toolbar_item_state_add(Elm_Object_Item *it, if (!_item_icon_set(icon_obj, "toolbar/", icon)) { - evas_object_del(icon_obj); - icon_obj = NULL; + ELM_SAFE_FREE(icon_obj, evas_object_del); icon = NULL; } @@ -3602,7 +3595,7 @@ elm_toolbar_item_state_del(Elm_Object_Item *it, eina_stringshare_del(state->label); eina_stringshare_del(state->icon_str); - if (state->icon) evas_object_del(state->icon); + evas_object_del(state->icon); free(state); item->states = eina_list_remove_list(item->states, del_state); diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index 750c972..0a37556 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/src/lib/elm_widget.c @@ -5063,8 +5063,7 @@ _elm_widget_item_free(Elm_Widget_Item *item) if (item->del_func) item->del_func((void *)item->data, item->widget, item); - if (item->view) - evas_object_del(item->view); + evas_object_del(item->view); eina_stringshare_del(item->access_info); diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index 993f4cd..6b4eb87 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -1498,8 +1498,7 @@ _elm_win_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) eina_stringshare_del(sd->icon_name); eina_stringshare_del(sd->role); evas_object_del(sd->icon); - - if (sd->main_menu) evas_object_del(sd->main_menu); + evas_object_del(sd->main_menu); _elm_win_profile_del(sd); _elm_win_available_profiles_del(sd); @@ -2471,8 +2470,7 @@ _elm_win_frame_add(Elm_Win_Smart_Data *sd, if (!elm_widget_theme_object_set (sd->obj, sd->frame_obj, "border", "base", style)) { - evas_object_del(sd->frame_obj); - sd->frame_obj = NULL; + ELM_SAFE_FREE(sd->frame_obj, evas_object_del); return; } @@ -2542,11 +2540,7 @@ _elm_win_frame_del(Elm_Win_Smart_Data *sd) { int w, h; - if (sd->client_obj) - { - evas_object_del(sd->client_obj); - sd->client_obj = NULL; - } + ELM_SAFE_FREE(sd->client_obj, evas_object_del); if (sd->frame_obj) { @@ -2580,8 +2574,7 @@ _elm_win_frame_del(Elm_Win_Smart_Data *sd) (sd->frame_obj, "elm,action,close", "elm", _elm_win_frame_cb_close); - evas_object_del(sd->frame_obj); - sd->frame_obj = NULL; + ELM_SAFE_FREE(sd->frame_obj, evas_object_del); } evas_output_framespace_set(sd->evas, 0, 0, 0, 0); @@ -2832,8 +2825,7 @@ _win_constructor(Eo *obj, void *_pd, va_list *list) tmp_sd.ee = ecore_evas_object_ecore_evas_get(tmp_sd.img_obj); if (!tmp_sd.ee) { - evas_object_del(tmp_sd.img_obj); - tmp_sd.img_obj = NULL; + ELM_SAFE_FREE(tmp_sd.img_obj, evas_object_del); } } break; diff --git a/legacy/elementary/src/lib/els_cursor.c b/legacy/elementary/src/lib/els_cursor.c index 340fbe2..733a4bc 100644 --- a/legacy/elementary/src/lib/els_cursor.c +++ b/legacy/elementary/src/lib/els_cursor.c @@ -182,8 +182,7 @@ _elm_cursor_obj_add(Evas_Object *obj, Elm_Cursor *cur) if (!_elm_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name, cur->style ? cur->style : "default")) { - evas_object_del(cur->obj); - cur->obj = NULL; + ELM_SAFE_FREE(cur->obj, evas_object_del); return EINA_FALSE; } @@ -439,8 +438,7 @@ elm_object_cursor_unset(Evas_Object *obj) { evas_object_event_callback_del_full(cur->obj, EVAS_CALLBACK_DEL, _elm_cursor_obj_del, cur); - evas_object_del(cur->obj); - cur->obj = NULL; + ELM_SAFE_FREE(cur->obj, evas_object_del); } if (cur->visible) @@ -518,11 +516,7 @@ elm_object_cursor_theme_search_enabled_set(Evas_Object *obj, Eina_Bool theme_sea { ELM_CURSOR_GET_OR_RETURN(cur, obj); cur->theme_search = theme_search; - if (cur->obj) - { - evas_object_del(cur->obj); - cur->obj = NULL; - } + ELM_SAFE_FREE(cur->obj, evas_object_del); _elm_cursor_cur_set(cur); } diff --git a/legacy/elementary/src/lib/els_tooltip.c b/legacy/elementary/src/lib/els_tooltip.c index 9157f31..dc899a5 100644 --- a/legacy/elementary/src/lib/els_tooltip.c +++ b/legacy/elementary/src/lib/els_tooltip.c @@ -183,8 +183,7 @@ _elm_tooltip_content_del(Elm_Tooltip *tt) (tt->content, EVAS_CALLBACK_DEL, _elm_tooltip_content_del_cb, tt); evas_object_hide(tt->content); - evas_object_del(tt->content); - tt->content = NULL; + ELM_SAFE_FREE(tt->content, evas_object_del); } static void -- 2.7.4