Skip to content

Conversation

@rolandlo
Copy link
Collaborator

@rolandlo rolandlo commented Dec 9, 2025

Closes #94

@rolandlo rolandlo mentioned this pull request Dec 9, 2025
collectgarbage("stop")
local vimage = vips_lib.vips_image_get_gainmap(self.vimage)
if vimage == ffi.NULL then
return nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to restart the gc here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for Lua 5.4, see below.

@rolandlo rolandlo force-pushed the add-vips_image_get_gainmap branch from ca7df97 to 7e8f5c4 Compare December 10, 2025 14:19
Copy link
Member

@jcupitt jcupitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oop, forgot to submit this one

end

function Image_method:get_gainmap()
collectgarbage("stop")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not certain you need to stop and restart the GC -- with the API change vips_image_get_gainmap now returns a true reference, so your pointer should be safe.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be, but there are some oddities in Lua 5.4 which cause a crash (illegal machine instruction) when running the uhdr.lua script (still seen in https://github.com/libvips/lua-vips/compare/ca7df971d6a3a34ce9a076e8c3e238812c1452f2..7e8f5c44813ee311e0acf1e3f5c4bd0bf97c175d) via lua5.4 uhdr.lua.
It works fine with lua5.3 and luajit without stopping the GC.

@rolandlo rolandlo force-pushed the add-vips_image_get_gainmap branch from 7e8f5c4 to ca515b0 Compare December 10, 2025 19:05
@rolandlo rolandlo merged commit caa08bb into libvips:master Dec 11, 2025
25 of 26 checks passed
@rolandlo rolandlo deleted the add-vips_image_get_gainmap branch December 11, 2025 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libvips 8.18

2 participants