if (!fd || !is_readable_file(fd->path)) return NULL;
if (file_cache_get(exif_cache, fd)) return fd->exif;
+ g_assert(fd->exif == NULL);
/* CACHE_TYPE_XMP_METADATA file should exist only if the metadata are
* not writable directly, thus it should contain the most up-to-date version */
};
static void file_cache_notify_cb(FileData *fd, NotifyType type, gpointer data);
+static void file_cache_remove_fd(FileCacheData *fc, FileData *fd);
FileCacheData *file_cache_new(FileCacheReleaseFunc release, gulong max_size)
{
fc->list = g_list_remove_link(fc->list, work);
fc->list = g_list_concat(work, fc->list);
- if (file_data_check_changed_files(fd)) /* this will eventually remove changed files from cache via file_cache_notify_cb */
+ if (file_data_check_changed_files(fd)) {
+ /* file has been changed, cance entry is no longer valid */
+ file_cache_remove_fd(fc, fd);
return FALSE;
-
+ }
if (debug_file_cache) file_cache_dump(fc);
return TRUE;
}