From bf6c0627792485bcdefe5aa055bece21ca22bbec Mon Sep 17 00:00:00 2001 From: N-R-K <79544946+N-R-K@users.noreply.github.com> Date: Sun, 27 Mar 2022 09:34:44 +0000 Subject: fix: thumbnail memory leak when removing file (#247) --- main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.c b/main.c index 33f5cde..e3ee016 100644 --- a/main.c +++ b/main.c @@ -165,6 +165,10 @@ void remove_file(int n, bool manual) if (n + 1 < filecnt) { if (tns.thumbs != NULL) { + if (tns.thumbs[n].im != NULL) { + imlib_context_set_image(tns.thumbs[n].im); + imlib_free_image_and_decache(); + } memmove(tns.thumbs + n, tns.thumbs + n + 1, (filecnt - n - 1) * sizeof(*tns.thumbs)); memset(tns.thumbs + filecnt - 1, 0, sizeof(*tns.thumbs)); -- cgit v1.2.3