layout: remove sizing_eval call when layout is already destructed. @fix
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Wed, 14 May 2014 03:02:10 +0000 (12:02 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 14 May 2014 03:02:10 +0000 (12:02 +0900)
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

src/lib/elm_layout.c
src/lib/elm_widget_layout.h
src/tests/Makefile.am
src/tests/elm_suite.c
src/tests/elm_suite.h
src/tests/elm_test_entry.c [new file with mode: 0644]

index 0e62d89cdf19acfb3eb5ec9d0e33fefeb7063822..d6fa3fc65effbf4794d36bdba4a90aee2b4dcbed 100644 (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());
 }
 
index 0d7b8d7f9433df6f4591b774407c08abebacf7ee..f005dd9d39b7d0925f0a8f5b6db31c93fc774fce 100644 (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;
 
 /**
index 84c763bb4b061090b311ab320e94768cb769caff..200ada7fa84c0ceffb2561ca667c5fe9b24f2274 100644 (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 = \
index 7056b35fe8409b8b1825cfe59a0a098197c85de6..f5868335b2970703b23992b69ecb2a7d2892197e 100644 (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 }
 };
 
index 3d4be29483c469fd3db433f2b49b46d88214ce37..bac0a5692d744754aca8c07ef8fe14f5ea533470 100644 (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 */
diff --git a/src/tests/elm_test_entry.c b/src/tests/elm_test_entry.c
new file mode 100644 (file)
index 0000000..70643ae
--- /dev/null
@@ -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);
+}