looking at the osg::Image header file, it appears that the data storage is not protected through reference counting.
AllocationMode _allocationMode; unsigned char* _data; the default allocation mode for an osg::Image is USE_NEW_DELETE, hence when one instance of your shallow copy is destroyed, it will delete[] the _data storage, making it unsafe to use from the 2nd instance. You could force an allocation mode of NO_DELETE, so the osg::Image object itself will never free its associated image data store - then your application is responsible for freeing up these resources. Christian 2016-08-16 12:35 GMT+02:00 Pierre-Jean Petitprez < pierre-jean.petitp...@inria.fr>: > Hi Sebastian, > > What do you mean by "reachable"? Deallocation doesn't mean the memory is >> cleaned or something. So having a raw pointer to the deallocated memory >> might give you the same data as long as no one is allocating memory there. >> >> I mean that after the first image is deleted, I still can use and perform > operations on the data through the second image. To rewrite my question, I > would like to know if data in an image is deallocated (and so it is not > safe to perform operations on it through the second image) when it's > shallow copied. I guess it is but I am not 100% sure. > > Thank you, > > Pierre-Jean > > Cheers >> Sebastian >> >>> >>> Thanks for enlightening me, >>> >>> Cheers, >>> Pierre-Jean >>> >>> ------------------ >>> Read this topic online here: >>> http://forum.openscenegraph.org/viewtopic.php?p=68380#68380 >>> >>> >>> >>> >>> >>> _______________________________________________ >>> osg-users mailing list >>> osg-users@lists.openscenegraph.org >>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens >>> cenegraph.org >>> >> >> >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org