nsxiv4b67816
fix: loading old frames due to multi-frame cache (#437)
by default imlib2 doesn't check the file's timestamp to avoid disk activity when loading from cache. however, this ends up breaking our autoreload functionality on multi-frame images. the reason why single frame images weren't broken was because `img_load()` calls `imlib_image_set_changes_on_disk()`, which tells imlib2 to check the timestamp before loading from cache. do the same thing for the multi-frame loader as well. additionally add a comment to img_load() explaining what's going on. Closes: https://codeberg.org/nsxiv/nsxiv/issues/436
+4 −0
1 file changed
- M image.c +4 −0
| @@ -506,6 +506,7 @@ static bool img_load_multiframe(img_t *img, const fileinfo_t *file) | |||
| 506 | 506 | } | |
| 507 | 507 | ||
| 508 | 508 | imlib_context_set_image(frame); | |
| 509 | + | imlib_image_set_changes_on_disk(); /* see img_load() for rationale */ | |
| 509 | 510 | imlib_image_get_frame_info(&finfo); | |
| 510 | 511 | assert(finfo.frame_count == (int)fcnt); | |
| 511 | 512 | assert(finfo.canvas_w == img->w && finfo.canvas_h == img->h); | |
| @@ -579,6 +580,9 @@ bool img_load(img_t *img, const fileinfo_t *file) | |||
| 579 | 580 | if ((img->im = img_open(file)) == NULL) | |
| 580 | 581 | return false; | |
| 581 | 582 | ||
| 583 | + | /* ensure that the image's timestamp is checked when loading from cache | |
| 584 | + | * to avoid issues like: https://codeberg.org/nsxiv/nsxiv/issues/436 | |
| 585 | + | */ | |
| 582 | 586 | imlib_image_set_changes_on_disk(); | |
| 583 | 587 | ||
| 584 | 588 | /* since v1.7.5, Imlib2 can parse exif orientation from jpeg files. | |