cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=62b469749a4b79351b9bc52d40b9249ee48086bf

commit 62b469749a4b79351b9bc52d40b9249ee48086bf
Author: Cedric Bail <[email protected]>
Date:   Thu Nov 21 14:46:59 2013 +0900

    eina: fix the crash seen by some during rebuild.
    
    Before this patch, we were unconditionnaly destroying the Eina_File if that 
one
    did change on disk. We also make sure that we remove the right entry from 
the cache
    if the file did change there.
---
 src/lib/eina/eina_file.c        |  1 -
 src/lib/eina/eina_file_common.c | 11 ++++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/lib/eina/eina_file.c b/src/lib/eina/eina_file.c
index 1ae3681..ca2fe61 100644
--- a/src/lib/eina/eina_file.c
+++ b/src/lib/eina/eina_file.c
@@ -868,7 +868,6 @@ eina_file_open(const char *path, Eina_Bool shared)
      {
         file->delete_me = EINA_TRUE;
         eina_hash_del(_eina_file_cache, file->filename, file);
-       eina_file_clean_close(file);
         file = NULL;
      }
 
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index 7952190..f6ae3be 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -463,6 +463,8 @@ EAPI void
 eina_file_close(Eina_File *file)
 {
    Eina_Bool leave = EINA_TRUE;
+   unsigned int length;
+   unsigned int key;
 
    EINA_SAFETY_ON_NULL_RETURN(file);
 
@@ -474,7 +476,14 @@ eina_file_close(Eina_File *file)
    eina_lock_release(&file->lock);
    if (leave) goto end;
 
-   eina_hash_del(_eina_file_cache, file->filename, file);
+   length = strlen(file->filename) + 1;
+   key = eina_hash_djb2(file->filename, length);
+   if (eina_hash_find_by_hash(_eina_file_cache,
+                              file->filename, length, key) == file)
+     {
+        eina_hash_del_by_key_hash(_eina_file_cache,
+                                  file->filename, length, key);
+     }
 
    eina_file_clean_close(file);
  end:

-- 


Reply via email to