efl/font: Avoid passing NULL glyphs arrays on unref

evas_common_font_glyphs_unref() *should* be called with valid glyphs
arrays.

Patch by: Paulo Alcantara <pcacjr@profusion.mobi>



SVN revision: 82658
This commit is contained in:
Paulo Alcantara 2013-01-11 19:48:00 +00:00 committed by Ulisses Furquim
parent 72eaa99676
commit 5eaba08284
2 changed files with 3 additions and 7 deletions

View File

@ -225,8 +225,6 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
void void
evas_common_font_glyphs_ref(Evas_Glyph_Array *array) evas_common_font_glyphs_ref(Evas_Glyph_Array *array)
{ {
if (!array) return;
eina_lock_take(&array->lock); eina_lock_take(&array->lock);
array->refcount++; array->refcount++;
eina_lock_release(&array->lock); eina_lock_release(&array->lock);
@ -235,8 +233,6 @@ evas_common_font_glyphs_ref(Evas_Glyph_Array *array)
void void
evas_common_font_glyphs_unref(Evas_Glyph_Array *array) evas_common_font_glyphs_unref(Evas_Glyph_Array *array)
{ {
if (!array) return;
eina_lock_take(&array->lock); eina_lock_take(&array->lock);
if (--array->refcount) if (--array->refcount)
{ {
@ -305,7 +301,7 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props)
* reference is only used to use this from another thread, which is now * reference is only used to use this from another thread, which is now
* holding the reference. * holding the reference.
*/ */
evas_common_font_glyphs_unref(text_props->glyphs); if (text_props->glyphs) evas_common_font_glyphs_unref(text_props->glyphs);
text_props->glyphs = malloc(sizeof(*text_props->glyphs)); text_props->glyphs = malloc(sizeof(*text_props->glyphs));
if (!text_props->glyphs) goto error; if (!text_props->glyphs) goto error;

View File

@ -89,8 +89,8 @@ evas_common_text_props_content_unref(Evas_Text_Props *props)
/* No content in this case */ /* No content in this case */
if (!props->info) if (!props->info)
return; return;
evas_common_font_glyphs_unref(props->glyphs); if (props->glyphs) evas_common_font_glyphs_unref(props->glyphs);
/* After unreferencing the glyph array, a thread will still hold /* After unreferencing the glyph array, a thread will still hold
* a reference, so this can be safely set to NULL. */ * a reference, so this can be safely set to NULL. */
props->glyphs = NULL; props->glyphs = NULL;