There is quite a bit of error handling code required by the fact that users may ctrl+c when copying an image, which causes the user lock to never be released. This is tough to understand and prone to errors.
In other projects I've switched to using a wrapping handle class that implements RAII (lock in constructors, unlock in destructor), which can guarantee that the lock is always released once it's out of scope, i.e., when exiting the getsnapshot function (for any reason). HebiCam should switch over as well.
There is quite a bit of error handling code required by the fact that users may ctrl+c when copying an image, which causes the user lock to never be released. This is tough to understand and prone to errors.
In other projects I've switched to using a wrapping handle class that implements RAII (lock in constructors, unlock in destructor), which can guarantee that the lock is always released once it's out of scope, i.e., when exiting the getsnapshot function (for any reason). HebiCam should switch over as well.