edje: do not check against eet if strings where never allocated.
authorCedric BAIL <cedric@osg.samsung.com>
Fri, 6 May 2016 23:47:56 +0000 (16:47 -0700)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 6 May 2016 23:47:56 +0000 (16:47 -0700)
src/lib/edje/edje_edit.c
src/lib/edje/edje_private.h
src/lib/edje/edje_textblock_styles.c

index e97c44f..da63dd7 100644 (file)
@@ -821,12 +821,14 @@ _edje_if_string_free(Edje *ed, const char **str)
    Eet_Dictionary *dict;
 
    if (!ed || !str) return;
+   if (!ed->file->allocated_strings) goto the_end;
 
    dict = eet_dictionary_get(ed->file->ef);
 
    if (!eet_dictionary_string_check(dict, *str))
      eina_stringshare_del(*str);
 
+ the_end:
    *str = NULL;
 }
 
@@ -837,6 +839,7 @@ _edje_if_string_replace(Edje *ed, const char **str, const char *str_new)
 
    if (!ed || !str) return;
 
+   ed->file->allocated_strings = EINA_TRUE;
    dict = eet_dictionary_get(ed->file->ef);
    if (*str && eet_dictionary_string_check(dict, *str))
      *str = eina_stringshare_add(str_new);
index 4681476..c70f282 100644 (file)
@@ -577,6 +577,7 @@ struct _Edje_File
    char                            fid[8+8+8+2];
 
    unsigned char                   free_strings : 1;
+   unsigned char                   allocated_strings : 1;
    unsigned char                   dangling : 1;
    unsigned char                  warning : 1;
 };
index 0cf8a05..2fef836 100644 (file)
@@ -463,7 +463,8 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
              /* Add and Handle tag parsed data */
              if (ts)
                {
-                  if (eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0)
+                  if (edf->allocated_strings &&
+                      eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0)
                     eina_stringshare_del(tag->value);
                   tag->value = eina_stringshare_add(ts);
                   eina_strbuf_append(txt, tag->value);
@@ -522,7 +523,9 @@ _edje_textblock_style_cleanup(Edje_File *edf)
 
         EINA_LIST_FREE(stl->tags, tag)
           {
-             if (tag->value && eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0)
+             if (edf->allocated_strings &&
+                 tag->value &&
+                 eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0)
                eina_stringshare_del(tag->value);
              if (edf->free_strings)
                {