LoadImageFile(const char *, IMG &)
creates a new device image object with the IMG
parameter being an “out” parameter. This means that the referenced IMG
variable will simply be overwritten. If you reuse the IMG
handle variable for the second LoadImageFile
call, the old device object the IMG
handle points to, is not released, but leaked. And the device is kept open. Treat the :cvb: handles (IMG
, NODE
,…) like raw pointers.
I personally use a smart handle for life-time management:
https://forum.commonvisionblox.com/t/old-image-broken-after-setting-new-camport/66/6?u=parsd