eina: remove the value from the hash before changing it !
authorCedric BAIL <cedric@efl.so>
Sun, 17 Nov 2013 08:11:56 +0000 (09:11 +0100)
committerCedric BAIL <cedric@efl.so>
Sun, 17 Nov 2013 11:20:02 +0000 (12:20 +0100)
This should fix bug T439.

src/lib/eina/eina_cow.c

index 0d7dd3a..ca99f5c 100644 (file)
@@ -430,6 +430,7 @@ eina_cow_free(Eina_Cow *cow, const Eina_Cow_Data **data)
 #endif
    ref->refcount--;
 
+   if (ref->refcount == 0) _eina_cow_hash_del(cow, *data, ref);
    *data = (Eina_Cow_Data*) cow->default_value;
 
    if (ref->refcount > 0)
@@ -443,7 +444,6 @@ eina_cow_free(Eina_Cow *cow, const Eina_Cow_Data **data)
 #ifdef EINA_COW_MAGIC_ON
    EINA_MAGIC_SET(ref, EINA_MAGIC_NONE);
 #endif
-   _eina_cow_hash_del(cow, *data, ref);
    _eina_cow_togc_del(cow, ref);
    eina_mempool_free(cow->pool, (void*) ref);
 }