layout: remove sizing_eval call when layout is already destructed. @fix

Summary:
Layout's sub_object_del function calls sizing_eval even if layout's smart_del
function has already been called (Due to widget_smart_del impl).
This patch adds 'destructed_is' flag to Elm_Layout_Smart_Data and prevents unneeded
sizing_eval calls when object is already destructed.
Patch also fixes SIGSEGV in layout derived entry widget caused by calling
sizing_eval after entry_smart_del destructor.

Added entry test to avoid regression for SIGSEGV bug.

Test Plan: run tests/elm_test_entry

Reviewers: raster, seoz, tasn, cedric

Differential Revision: https://phab.enlightenment.org/D823
This commit is contained in:
Lukasz Stanislawski 2014-05-14 12:02:10 +09:00 committed by Carsten Haitzler (Rasterman)
parent 48a077b62e
commit e62b07f779
6 changed files with 32 additions and 0 deletions

View File

@ -520,6 +520,7 @@ _elm_layout_elm_widget_sub_object_del(Eo *obj, Elm_Layout_Smart_Data *sd, Evas_O
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_sub_object_del(sobj));
if (!int_ret) return EINA_FALSE;
if (sd->destructed_is) return EINA_TRUE;
EINA_LIST_FOREACH(sd->subs, l, sub_d)
{
@ -799,6 +800,8 @@ _elm_layout_evas_smart_del(Eo *obj, Elm_Layout_Smart_Data *sd)
}
}
sd->destructed_is = EINA_TRUE;
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
}

View File

@ -77,6 +77,7 @@ typedef struct _Elm_Layout_Smart_Data
Eina_Bool restricted_calc_w : 1;
Eina_Bool restricted_calc_h : 1;
Eina_Bool can_access : 1; /**< This is true when all text(including textblock) parts can be accessible by accessibility. */
Eina_Bool destructed_is : 1; /**< This flag indicates if Elm_Layout destructor was called */
} Elm_Layout_Smart_Data;
/**

View File

@ -8,6 +8,7 @@ elm_suite_SOURCES = \
elm_suite.c \
elm_test_check.c \
elm_test_colorselector.c \
elm_test_entry.c \
elm_test_init.c
elm_suite_CPPFLAGS = \

View File

@ -17,6 +17,7 @@ static const Elementary_Test_Case etc[] = {
{ "Elementary", elm_test_init },
{ "elm_check", elm_test_check },
{ "elm_colorselector", elm_test_colorselector },
{ "elm_entry", elm_test_entry},
{ NULL, NULL }
};

View File

@ -6,5 +6,6 @@
void elm_test_init(TCase *tc);
void elm_test_check(TCase *tc);
void elm_test_colorselector(TCase *tc);
void elm_test_entry(TCase *tc);
#endif /* _ELM_SUITE_H */

View File

@ -0,0 +1,25 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Elementary.h>
#include "elm_suite.h"
START_TEST (elm_entry_del)
{
Evas_Object *win, *entry;
elm_init(1, NULL);
win = elm_win_add(NULL, "check", ELM_WIN_BASIC);
entry = elm_entry_add(win);
elm_object_text_set(entry, "TEST");
elm_shutdown();
}
END_TEST
void elm_test_entry(TCase *tc)
{
tcase_add_test(tc, elm_entry_del);
}