From 13c585f10b38d14c962ac697b5ac98a2a63df0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20L=C3=B6tscher?= Date: Thu, 28 Mar 2024 21:50:19 +0100 Subject: [PATCH] Fix crash with write_to_file/buffer with Lua 5.4 --- src/vips/Image_methods.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vips/Image_methods.lua b/src/vips/Image_methods.lua index 17fc524..0dd5911 100644 --- a/src/vips/Image_methods.lua +++ b/src/vips/Image_methods.lua @@ -370,20 +370,23 @@ end -- writers function Image_method:write_to_file(vips_filename, ...) + collectgarbage("stop") local filename = to_string_copy(vips_lib.vips_filename_get_filename(vips_filename)) local options = to_string_copy(vips_lib.vips_filename_get_options(vips_filename)) local name = vips_lib.vips_foreign_find_save(filename) + collectgarbage("restart") if name == ffi.NULL then error(verror.get()) end - return voperation.call(ffi.string(name), options, self, filename, unpack { ... }) end function Image_method:write_to_buffer(format_string, ...) + collectgarbage("stop") local options = to_string_copy(vips_lib.vips_filename_get_options(format_string)) local name = vips_lib.vips_foreign_find_save_buffer(format_string) + collectgarbage("restart") if name == ffi.NULL then error(verror.get()) end