Hi Ola,

On 27 August 2012 16:31, Ola Nilsson <[email protected]> wrote:
> Yes, the ref count is zero but the destructor chain has not yet completed,
> by induction it hasn't passed ~TerrainTile. (If it had unregisterTile would
> have been called and completed.) Right?

Thinking about your explanation, I think you are correct,the
Terrain::unregisterTile won't be allowed to complete because the
Terrain::traverse() will be holding the Terrain::_mutex so the
destructor won't be able to finish and have the memory fully deleted
and be able to be recycled.

> In this situation memory is not yet recycled and the object's parents data
> (Referenced) should be safe to access and even manipulate. Right?

Safe... possible, it still doesn't feel robust though.

> Btw. the new code passes my modified osgterrain test, which of course
> doesn't prove anything...

It's an encouraging start though.  I do wonder if in your changes
there is a need to take a ref_ptr<> and then check for a
referenceCount() of 1, as if the ref count is zero to start with then
just checking against 0 without the ref_ptr<> should be sufficient a
test to see if the object has been deleted.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to