Replies: 2 comments
-
Hello @jaubourg, The blob keeps ownership, so the pointer from https://libvips.github.io/libvips/API/current/libvips-type.html#vips-blob-get You can see the Yes, you need to take a copy if you want to keep the value around. Blobs are reference-counted, so you can't really steal the libvips value (it might be in use elsewhere). |
Beta Was this translation helpful? Give feedback.
-
Hey @jcupitt , It seems to make sense but since I never interact with the VipsBlob directly (everything is encapsulated in VImage from my code's POV) I have to admit determining what's movable and what's not is pretty tricky. Thanks for the quick answer, it's highly appreciated! |
Beta Was this translation helpful? Give feedback.
-
The documentation is pretty sparse on the subject but
VImage::get_blob
returns aconst void *
or so seems to imply gcc. As such, it would mean the memory shouldn't be freed but it seems a bit weird to me.Who has ownership of the returned value? If it's the caller, how do we free it? Using
g_free
? Do I need to copy the memory block myself and not to rely on the originalconst void *
in case it gets freed at one point?Beta Was this translation helpful? Give feedback.
All reactions