Evas text textblock: call evas_font_free even on null fonts

A null font set can potentially be stored and passed on. There is no
specific fallback in our codebase to roll-back if something like that
occurs.

This fixes a case where an entry of a null font was not removed from the
fonts_cache and was leaked to subsequent tests (the null font entry was
not removed from the fonts_cache).

Note that this was only apparent when EFL was built with
`--disable-fontconfig`, likely due to fontconfig succeeding to always
retrieve some non-null font.

@fix
This commit is contained in:
Daniel Hirt 2018-07-16 00:35:44 +03:00
parent 93397449d4
commit cafe84a2c2
2 changed files with 4 additions and 7 deletions

View File

@ -433,11 +433,8 @@ _evas_text_font_reload(Eo *eo_obj, Evas_Text_Data *o)
}
/* DO IT */
if (o->font)
{
evas_font_free(o->font);
o->font = NULL;
}
evas_font_free(o->font);
o->font = NULL;
o->font = evas_font_load(obj->layer->evas->font_path,
obj->layer->evas->hinting,
@ -1656,7 +1653,7 @@ evas_object_text_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
if (o->cur.source) eina_stringshare_del(o->cur.source);
if (o->bidi_delimiters) eina_stringshare_del(o->bidi_delimiters);
if (o->cur.text) free(o->cur.text);
if (o->font && obj->layer && obj->layer->evas)
if (obj->layer && obj->layer->evas)
evas_font_free(o->font);
o->font = NULL;
o->cur.utf8_text = NULL;

View File

@ -4575,7 +4575,7 @@ _format_finalize(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt)
fmt->font.source,
(int)(((double) fmt->font.size) * obj->cur->scale),
fmt->font.bitmap_scalable);
if (of) evas_font_free(of);
evas_font_free(of);
}
static Efl_Canvas_Text_Filter_Program *