From: Youngbok Shin Date: Fri, 4 Sep 2020 08:18:06 +0000 (+0900) Subject: evas/textblock: fix a memory issue caused by recreating ellipsis item X-Git-Tag: accepted/tizen/unified/20200907.045103~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F52%2F243252%2F2;p=platform%2Fupstream%2Fefl.git evas/textblock: fix a memory issue caused by recreating ellipsis item Change-Id: Ib50e95a5f72156afc4d4112cb3a9b3f0de2fdae0 --- diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index f1f4af6..cab3966 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -1011,9 +1011,12 @@ _item_free(Efl_Canvas_Textblock_Data *o, * @param ln the layout line to be freed, must not be NULL. */ static void -_line_free(Evas_Object_Textblock_Line *ln) +_line_free(Efl_Canvas_Textblock_Data *o, Evas_Object_Textblock_Line *ln) { /* Items are freed from the logical list, except for the ellip item */ + if (o->ellip_ti && (_ITEM(o->ellip_ti)->ln == ln)) + _ITEM(o->ellip_ti)->ln = NULL; + if (ln) free(ln); } @@ -4317,7 +4320,7 @@ _paragraph_clear(Efl_Canvas_Textblock_Data *o, } } - _line_free(ln); + _line_free(o, ln); } } @@ -5038,10 +5041,7 @@ loop_advance: c->par->lines = (Evas_Object_Textblock_Line *)eina_inlist_remove( EINA_INLIST_GET(c->par->lines), EINA_INLIST_GET(c->ln)); - if (c->o->ellip_ti && (_ITEM(c->o->ellip_ti)->ln == c->ln)) - _ITEM(c->o->ellip_ti)->ln = NULL; - - _line_free(c->ln); + _line_free(c->o, c->ln); c->ln = NULL; c->vertical_ellipsis = EINA_TRUE; @@ -6324,7 +6324,7 @@ _layout_ellipsis_item_new(Ctxt *c, const Evas_Object_Textblock_Item *cur_it) size_t len = 1; /* The length of _ellip_str */ /* We can free it here, cause there's only one ellipsis item per tb. */ - if (c->o->ellip_ti) _item_free(c->o, c->evas_o, NULL, _ITEM(c->o->ellip_ti)); + if (c->o->ellip_ti) _item_free(c->o, c->evas_o, _ITEM(c->o->ellip_ti)->ln, _ITEM(c->o->ellip_ti)); c->o->ellip_ti = ellip_ti = _layout_text_item_new(c, cur_it->format); ellip_ti->parent.text_node = cur_it->text_node; ellip_ti->parent.text_pos = cur_it->text_pos;