From: barbieri Date: Fri, 10 Feb 2012 21:34:28 +0000 (+0000) Subject: value: allow multiple flush. X-Git-Tag: 2.0_alpha~33^2~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=173563f10661c7bdd897353a97ed89204aa4a41c;p=framework%2Fuifw%2Feina.git value: allow multiple flush. multiple flush may happen when handling errors. May be used in some cases. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@67839 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/eina_value.c b/src/lib/eina_value.c index 97cab5b..a4c6428 100644 --- a/src/lib/eina_value.c +++ b/src/lib/eina_value.c @@ -2249,7 +2249,11 @@ static Eina_Bool _eina_value_type_stringshare_flush(const Eina_Value_Type *type __UNUSED__, void *mem) { const char **tmem = mem; - if (*tmem) eina_stringshare_del(*tmem); + if (*tmem) + { + eina_stringshare_del(*tmem); + *tmem = NULL; + } return EINA_TRUE; } @@ -2281,7 +2285,11 @@ static Eina_Bool _eina_value_type_string_flush(const Eina_Value_Type *type __UNUSED__, void *mem) { char **tmem = mem; - if (*tmem) free(*tmem); + if (*tmem) + { + free(*tmem); + *tmem = NULL; + } return EINA_TRUE; } @@ -3573,6 +3581,8 @@ _eina_value_type_blob_flush(const Eina_Value_Type *type __UNUSED__, void *mem) Eina_Value_Blob *tmem = mem; if ((ops) && (ops->free)) ops->free(ops, (void *)tmem->memory, tmem->size); + tmem->memory = NULL; + tmem->size = 0; return EINA_TRUE; } @@ -4003,6 +4013,9 @@ _eina_value_type_struct_flush(const Eina_Value_Type *type __UNUSED__, void *mem) else free(tmem->memory); + tmem->memory = NULL; + tmem->desc = NULL; + return ret; }