This method is called after the image class releases its image buffer. In case a user buffer has been attached using CPylonImage::AttachUserBuffer() you can use this to free your user buffer.
In case you created the event handler on the heap using new, you can call delete this at the end of the function.
// Sample handler to show how to delete the handler when allocating the handler on the heap.classMyHandler:publicCPylonImageUserBufferEventHandler{OnPylonImageUserBufferDetached(void*pUserBuffer,size_tbufferSizeBytes)override{// Use our custom memory allocator to free the user buffer.MyCustomFreeMemory(pUserBuffer);// Delete the handler.deletethis;}};// Use our custom memory allocator for pixel data.void*pUserBuffer=MyCustomAllocateMemory(640*480);// Attach user buffer using a heap-allocated event handler.CPylonImageimage;image.AttachUserBuffer(pUserBuffer,(640*480),PixelType_Mono8,640,480,0,ImageOrientation_TopDown,newMyHandler());
The default implementation does nothing. You can override this function to execute custom code.