<div dir="ltr"><div><div><div><br></div>looking at the osg::Image header file, it appears that the data storage is not protected through reference counting.<br><br>        AllocationMode _allocationMode;<br>        unsigned char* _data;<br><br></div>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.<br><br>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.<br><br></div><div>Christian<br></div><div><div><br><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-16 12:35 GMT+02:00 Pierre-Jean Petitprez <span dir="ltr"><<a href="mailto:pierre-jean.petitprez@inria.fr" target="_blank">pierre-jean.petitprez@inria.fr</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sebastian,<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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.<br>
<br>
</blockquote></span>
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.<br>
<br>
Thank you,<br>
<br>
Pierre-Jean<div class="HOEnZb"><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Cheers<br>
Sebastian<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks for enlightening me,<br>
<br>
Cheers,<br>
Pierre-Jean<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=68380#68380" rel="noreferrer" target="_blank">http://forum.openscenegraph.or<wbr>g/viewtopic.php?p=68380#68380</a><br>
<br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph<wbr>.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.or<wbr>g/listinfo.cgi/osg-users-opens<wbr>cenegraph.org</a> <br>
</blockquote>
<br>
<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph<wbr>.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.or<wbr>g/listinfo.cgi/osg-users-opens<wbr>cenegraph.org</a><br>
</blockquote>
<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph<wbr>.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.or<wbr>g/listinfo.cgi/osg-users-opens<wbr>cenegraph.org</a><br>
</div></div></blockquote></div><br></div>