-
Notifications
You must be signed in to change notification settings - Fork 9
Add vips_image_get_gainmap #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| collectgarbage("stop") | ||
| local vimage = vips_lib.vips_image_get_gainmap(self.vimage) | ||
| if vimage == ffi.NULL then | ||
| return nil |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
ca7df97 to
7e8f5c4
Compare
jcupitt
left a comment
There was a problem hiding this 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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
7e8f5c4 to
ca515b0
Compare
Closes #94