Hi Mikhail,

If you want to remove elements from the scene graph but delay
destruction to be done in a background thread the way to do it take a
ref_ptr<> to the subgraph you want to remove to prevent it from being
deleted, then remove the subgraph from the scene within the update
phase of the viewer frame, then pass this ref_ptr<> to the background
thread.  Personally I wouldn't use co-opt the DatabasePager for doing
this - although it does supports this already, conceptually it doesn't
make for a clean application.

Robert.

On 17 February 2012 07:10, Mikhail I. Izmestev <izmmish...@gmail.com> wrote:
> Hi,
>
> To remove heavy in destruction objects (which will free large buffers and
> etc.) I use method like in DatabasePager - hold object references and pass
> they to another thread for destructing.
>
> But there is one case which cause crash.
>
>        (root)
>           |
>      (some nodes)
>         (...)
>      |        |
>   (nodeA)  (nodeB)
>      \        /
>        \    /
>       (nodeC)
>          |
>        (...)
>          |
>       (nodeD)
>
> So we have nodeC with two parents, and in some moment we want to delete
> subgraph with nodeA.
> We remove from graph parents of nodeA and hold it reference to be destructed
> later in another thread.
> Another thread decrease reference for parents of nodeA and initialize
> destruction, so nodeA have no more references and it want to be deleted, it
> inform children about that and request to remove it from parent list.
> But in render thread we still render main graph and it traverse nodeC, but
> someone like nodeD changed it's matrix, this process require to dirtyBound,
> and dirtyBound inform all parents about this and tries to walk backward for
> all parents and nodeA too.
>
> So one thread iterate _parent vector, second thread change this vector, and
> in result CRASH!
>
> Looks like DatabasePager affects this problem too.
>
> What you can advice in this case?
>
> Mikhail.
> _______________________________________________
> 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

Reply via email to