Skip to content

Commit

Permalink
fixed exif_read_fd
Browse files Browse the repository at this point in the history
- add fd to cache immediately
- do not check file presence, the result could be inconsistent with the cache
  • Loading branch information
nadvornik committed Aug 9, 2012
1 parent 5ab7044 commit fa99aa2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/exif-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ ExifData *exif_read_fd(FileData *fd)

if (!exif_cache) exif_init_cache();

if (!fd || !is_readable_file(fd->path)) return NULL;
if (!fd) return NULL;

if (file_cache_get(exif_cache, fd)) return fd->exif;
g_assert(fd->exif == NULL);
Expand All @@ -668,6 +668,7 @@ ExifData *exif_read_fd(FileData *fd)
fd->exif = exif_read(fd->path, sidecar_path, fd->modified_xmp);

g_free(sidecar_path);
file_cache_put(exif_cache, fd, 1);
return fd->exif;
}

Expand All @@ -676,8 +677,6 @@ void exif_free_fd(FileData *fd, ExifData *exif)
{
if (!fd) return;
g_assert(fd->exif == exif);

file_cache_put(exif_cache, fd, 1);
}

/* embedded icc in jpeg */
Expand Down

0 comments on commit fa99aa2

Please sign in to comment.