From 79b493c3cd30255d26a34ae628c722184b8a6819 Mon Sep 17 00:00:00 2001 From: tasn Date: Thu, 10 Feb 2011 15:29:13 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@56924 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/engines/common/evas_text_utils.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/engines/common/evas_text_utils.c b/src/lib/engines/common/evas_text_utils.c index 954000d..b94e6ff 100644 --- a/src/lib/engines/common/evas_text_utils.c +++ b/src/lib/engines/common/evas_text_utils.c @@ -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; -- 2.7.4