efl_ui_tab_bar: do not perform insertion if existing is not added
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Fri, 6 Sep 2019 12:00:32 +0000 (14:00 +0200)
committerYeongjong Lee <yj34.lee@samsung.com>
Mon, 16 Sep 2019 01:23:00 +0000 (10:23 +0900)
same as the previous commit, just for efl_ui_tab_bar.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9862

src/lib/elementary/efl_ui_tab_bar.c

index a988a56..05e32ca 100644 (file)
@@ -186,6 +186,7 @@ _efl_ui_tab_bar_efl_pack_linear_pack_end(Eo *obj, Efl_Ui_Tab_Bar_Data *pd, Efl_G
 EOLIAN static Eina_Bool
 _efl_ui_tab_bar_efl_pack_linear_pack_before(Eo *obj, Efl_Ui_Tab_Bar_Data *pd, Efl_Gfx_Entity *subobj, const Efl_Gfx_Entity *existing)
 {
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_pack_index_get(pd->bx, existing) >= 0, EINA_FALSE);
    EINA_SAFETY_ON_FALSE_RETURN_VAL(_register_item(obj, pd, subobj), EINA_FALSE);
    return efl_pack_before(pd->bx, subobj, existing);
 }
@@ -193,6 +194,7 @@ _efl_ui_tab_bar_efl_pack_linear_pack_before(Eo *obj, Efl_Ui_Tab_Bar_Data *pd, Ef
 EOLIAN static Eina_Bool
 _efl_ui_tab_bar_efl_pack_linear_pack_after(Eo *obj, Efl_Ui_Tab_Bar_Data *pd, Efl_Gfx_Entity *subobj, const Efl_Gfx_Entity *existing)
 {
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_pack_index_get(pd->bx, existing) >= 0, EINA_FALSE);
    EINA_SAFETY_ON_FALSE_RETURN_VAL(_register_item(obj, pd, subobj), EINA_FALSE);
    return efl_pack_after(pd->bx, subobj, existing);
 }