skinlist: avoid 'Too many open files' errors

Due to application-specific file descriptor limits,
the garbage collector cannot close the descriptors in time,
resulting in unexpected file open errors.
This commit is contained in:
SmallJoker 2024-07-22 18:41:11 +02:00
parent b7cd514cea
commit df62f2042d

View File

@ -92,6 +92,7 @@ function skins.register_skin(path, filename)
skin_obj:set_meta("name", data[1]) skin_obj:set_meta("name", data[1])
skin_obj:set_meta("author", data[2]) skin_obj:set_meta("author", data[2])
skin_obj:set_meta("license", data[3]) skin_obj:set_meta("license", data[3])
file:close() -- do not rely on delayed GC
end end
end end
@ -102,6 +103,7 @@ function skins.register_skin(path, filename)
if fh then if fh then
dbgprint("Found preview", preview_name) dbgprint("Found preview", preview_name)
skin_obj:set_preview(preview_name) skin_obj:set_preview(preview_name)
fh:close() -- do not rely on delayed GC
end end
end end