diff options
author | Cedric Bail <cedric.bail@samsung.com> | 2013-11-21 14:46:59 +0900 |
---|---|---|
committer | Cedric Bail <cedric.bail@samsung.com> | 2013-11-21 14:49:08 +0900 |
commit | 62b469749a4b79351b9bc52d40b9249ee48086bf (patch) | |
tree | 5cabfe20485dadf6a7de2db316e50363b8d4288d /src/lib/eina | |
parent | eea338764abcf38c8be404be7e3c540cfedc002b (diff) |
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.
Diffstat (limited to 'src/lib/eina')
-rw-r--r-- | src/lib/eina/eina_file.c | 1 | ||||
-rw-r--r-- | 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 1ae3681f80..ca2fe612dc 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) | |||
868 | { | 868 | { |
869 | file->delete_me = EINA_TRUE; | 869 | file->delete_me = EINA_TRUE; |
870 | eina_hash_del(_eina_file_cache, file->filename, file); | 870 | eina_hash_del(_eina_file_cache, file->filename, file); |
871 | eina_file_clean_close(file); | ||
872 | file = NULL; | 871 | file = NULL; |
873 | } | 872 | } |
874 | 873 | ||
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c index 7952190328..f6ae3bed5e 100644 --- a/src/lib/eina/eina_file_common.c +++ b/src/lib/eina/eina_file_common.c | |||
@@ -463,6 +463,8 @@ EAPI void | |||
463 | eina_file_close(Eina_File *file) | 463 | eina_file_close(Eina_File *file) |
464 | { | 464 | { |
465 | Eina_Bool leave = EINA_TRUE; | 465 | Eina_Bool leave = EINA_TRUE; |
466 | unsigned int length; | ||
467 | unsigned int key; | ||
466 | 468 | ||
467 | EINA_SAFETY_ON_NULL_RETURN(file); | 469 | EINA_SAFETY_ON_NULL_RETURN(file); |
468 | 470 | ||
@@ -474,7 +476,14 @@ eina_file_close(Eina_File *file) | |||
474 | eina_lock_release(&file->lock); | 476 | eina_lock_release(&file->lock); |
475 | if (leave) goto end; | 477 | if (leave) goto end; |
476 | 478 | ||
477 | eina_hash_del(_eina_file_cache, file->filename, file); | 479 | length = strlen(file->filename) + 1; |
480 | key = eina_hash_djb2(file->filename, length); | ||
481 | if (eina_hash_find_by_hash(_eina_file_cache, | ||
482 | file->filename, length, key) == file) | ||
483 | { | ||
484 | eina_hash_del_by_key_hash(_eina_file_cache, | ||
485 | file->filename, length, key); | ||
486 | } | ||
478 | 487 | ||
479 | eina_file_clean_close(file); | 488 | eina_file_clean_close(file); |
480 | end: | 489 | end: |