summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitalii Vorobiov <vi.vorobiov@samsung.com>2015-11-04 13:58:58 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-11-04 13:58:59 +0900
commitaefcb11444f6172b10129967956f3e6bde4dca04 (patch)
treebfe8e859522863a88a0a15dc79db861c00f7b0c2
parent4ce59a4f0878ea7cff72ddad75706a47bae76fe4 (diff)
downloadefl-aefcb11444f6172b10129967956f3e6bde4dca04.tar.gz
Evas Text: avoid SIGSEV while ellipsis recalculation
Summary: Fix Segmentation Fault when TEXT part getting resized and when it has some params (for example ellipsis). Fix T2640 @fix Test Plan: Refer to T2640 Reviewers: raster, Hermet, seoz, herdsman, cedric, reutskiy.v.v, NikaWhite Subscribers: stefan_schmidt, tasn, cedric Maniphest Tasks: T2640 Differential Revision: https://phab.enlightenment.org/D2944
-rw-r--r--src/lib/evas/canvas/evas_object_text.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index 3e3e9ffe97..c066a408d2 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -879,21 +879,27 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t
/* FIXME: We shouldn't do anything. */
}
- int cut = ENFN->font_last_up_to_pos(ENDT,
- o->font,
- &itr->text_props,
- ellip_frame - (advance + l + r),
- 0);
- if (cut >= 0)
+ /* In case when we reach end of itr list, and have NULL */
+ int cut = -1;
+ if (itr && (itr != end_ellip_it))
{
- end_ellip_it->text_pos = itr->text_pos + cut;
- end_ellip_it->visual_pos = itr->visual_pos + cut;
- if (_layout_text_item_trim(obj, o, itr, cut, EINA_TRUE))
+ cut = ENFN->font_last_up_to_pos(ENDT,
+ o->font,
+ &itr->text_props,
+ ellip_frame - (advance + l + r),
+ 0);
+ if (cut >= 0)
{
- itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next;
+ end_ellip_it->text_pos = itr->text_pos + cut;
+ end_ellip_it->visual_pos = itr->visual_pos + cut;
+ if (_layout_text_item_trim(obj, o, itr, cut, EINA_TRUE))
+ {
+ itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next;
+ }
}
}
+
/* Remove the rest of the items */
while (itr)
{