Evas text_utils: make the text_props_content_ref/unref more robust.

Don't allocate a text info if the length is 0. No point in that because
content won't be allocated anyway.

SVN revision: 56924
This commit is contained in:
Tom Hacohen 2011-02-10 15:29:13 +00:00
parent b2029f0648
commit f0eebf1696
1 changed files with 9 additions and 4 deletions

View File

@ -39,8 +39,8 @@ evas_common_text_props_content_copy_and_ref(Evas_Text_Props *dst,
void
evas_common_text_props_content_ref(Evas_Text_Props *props)
{
/* No info in this case */
if (props->len == 0)
/* No content in this case */
if (!props->info)
return;
props->info->refcount++;
@ -49,8 +49,8 @@ evas_common_text_props_content_ref(Evas_Text_Props *props)
void
evas_common_text_props_content_unref(Evas_Text_Props *props)
{
/* No info in this case */
if (props->len == 0)
/* No content in this case */
if (!props->info)
return;
if (--(props->info->refcount) == 0)
@ -175,6 +175,11 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
{
evas_common_text_props_content_unref(text_props);
}
if (len == 0)
{
text_props->info = NULL;
text_props->start = text_props->len = text_props->text_offset = 0;
}
text_props->info = calloc(1, sizeof(Evas_Text_Props_Info));
fi = fn->fonts->data;