From ca35233c073f165534ec0e3c841a1e56de3a21fd Mon Sep 17 00:00:00 2001 From: Jihyeon Seol Date: Fri, 28 Sep 2012 09:28:18 +0000 Subject: [PATCH] From: Jihyeon Seol Subject: [E-devel] [Patch] multibuttonentry - data corruption issue of the box list here is a problem in the data corruption of the box list in _box_layout_cb() of the multibuttonentry. EINA_LIST_FOREACH is used to move and resize the objects. but if box unpack/pack is called in the EINA_LIST_FOREACH loop, the data of the box list will be corrupted. This problem can not be solved immediately due to the structural problems of the MBE. So the attached patch, a workaround, avoids calling unpack/pack in the EINA_LIST_FOREACH loop. I am in the process of refactoring MBE but in the mean time, this patch will resolve the above issue. SVN revision: 77192 --- legacy/elementary/ChangeLog | 4 ++++ legacy/elementary/NEWS | 1 + legacy/elementary/src/lib/elc_multibuttonentry.c | 15 +++++++++++---- .../src/lib/elm_widget_multibuttonentry.h | 1 + 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index cd37954196..015e87aa53 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -547,3 +547,7 @@ * Fix disk selector selection of middle item when obj not at 0. +2012-09-28 Jihyeon Seol + + * Fix list corruption issue in multibuttonentry. + diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index 456dcc2151..e1642aabac 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -32,6 +32,7 @@ Fixes: * Fix bubble info field set. * Escape theme filename correctly. * Fix diskselector selection of middle item. + * Fix multibuttonentry list corruption. Removals: diff --git a/legacy/elementary/src/lib/elc_multibuttonentry.c b/legacy/elementary/src/lib/elc_multibuttonentry.c index 35db3ed939..a891a841e3 100644 --- a/legacy/elementary/src/lib/elc_multibuttonentry.c +++ b/legacy/elementary/src/lib/elc_multibuttonentry.c @@ -315,7 +315,8 @@ _view_update(Evas_Object *obj) _shrink_mode_set(obj, EINA_TRUE); // update guidetext - _visual_guide_text_set(obj); + if (sd->guide_text_vis_enable) + _visual_guide_text_set(obj); } static Eina_Bool @@ -1171,7 +1172,7 @@ _item_max_height_calculate(Evas_Object *box, static void _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, - void *data __UNUSED__) + void *data) { Evas_Coord cw = 0, ch = 0, cmaxh = 0, obj_index = 0; Evas_Coord x, y, w, h, xx, yy; @@ -1180,7 +1181,9 @@ _box_layout_cb(Evas_Object *o, const Eina_List *l; Evas_Object *obj; double ax, ay; - + + ELM_MULTIBUTTONENTRY_DATA_GET(data, sd); + _box_min_size_calculate(o, priv); evas_object_geometry_get(o, &x, &y, &w, &h); @@ -1201,6 +1204,8 @@ _box_layout_cb(Evas_Object *o, xx = x; yy = y; + sd->guide_text_vis_enable = EINA_FALSE; + EINA_LIST_FOREACH (priv->children, l, opt) { Evas_Coord mnw, mnh, mxw, mxh; @@ -1251,6 +1256,7 @@ _box_layout_cb(Evas_Object *o, obj_index++; } + sd->guide_text_vis_enable = EINA_TRUE; } static void @@ -1263,7 +1269,7 @@ _view_init(Evas_Object *obj) sd->box = elm_box_add(obj); if (!sd->box) return; - elm_box_layout_set(sd->box, _box_layout_cb, NULL, NULL); + elm_box_layout_set(sd->box, _box_layout_cb, obj, NULL); elm_box_homogeneous_set(sd->box, EINA_FALSE); elm_layout_content_set(obj, "box.swallow", sd->box); @@ -1377,6 +1383,7 @@ _elm_multibuttonentry_smart_add(Evas_Object *obj) priv->add_callback = NULL; priv->add_callback_data = NULL; priv->editable = EINA_TRUE; + priv->guide_text_vis_enable = EINA_TRUE; _view_init(obj); _callbacks_register(obj); diff --git a/legacy/elementary/src/lib/elm_widget_multibuttonentry.h b/legacy/elementary/src/lib/elm_widget_multibuttonentry.h index 3abc86538f..54e733eb3a 100644 --- a/legacy/elementary/src/lib/elm_widget_multibuttonentry.h +++ b/legacy/elementary/src/lib/elm_widget_multibuttonentry.h @@ -203,6 +203,7 @@ struct _Elm_Multibuttonentry_Smart_Data Eina_Bool last_btn_select : 1; Eina_Bool editable : 1; Eina_Bool focused : 1; + Eina_Bool guide_text_vis_enable : 1; }; /**