Krolyxon
Commit bf6c062

Branches

Refs →

nsxivbf6c062

fix: thumbnail memory leak when removing file (#247)

Author
N-R-K
Date
2022-03-27 09:34 +0000
Committer
GitHub · 2022-03-27 09:34 +0000
Parent
590d9fe
Commit
bf6c0627792485bcdefe5aa055bece21ca22bbec

+4 −0

1 file changed

  1. M main.c +4 −0
M main.c View
@@ -165,6 +165,10 @@ void remove_file(int n, bool manual)
165165
166166 if (n + 1 < filecnt) {
167167 if (tns.thumbs != NULL) {
168+ if (tns.thumbs[n].im != NULL) {
169+ imlib_context_set_image(tns.thumbs[n].im);
170+ imlib_free_image_and_decache();
171+ }
168172 memmove(tns.thumbs + n, tns.thumbs + n + 1, (filecnt - n - 1) *
169173 sizeof(*tns.thumbs));
170174 memset(tns.thumbs + filecnt - 1, 0, sizeof(*tns.thumbs));