Re: [osg-users] crash in frame(); in the multithreading

2008-07-22 Thread Robert Osfield
Hi Xiaodong,

2008/7/22 Wu Xiaodong [EMAIL PROTECTED]:
  Based on your opinion  that the crash is a straight iterator invalidation
 issue due to your add/removing
 stuff from the scene graph. , can you give me some suggestions on fix the
 bug?

Moving the add/remove out of the callback and into the main body of
the frameloop will solve the problem.  It's also possible move the
add/move operation to the parent of the node you are currently
operating on, so that you are nested within any calls that are using
the iterators that you are invalidating.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] crash in frame(); in the multithreading

2008-07-21 Thread Wu Xiaodong
 Based on your opinion  that the crash is *a straight iterator invalidation
issue due to your add/removing
stuff from the scene graph.* , can you give me some suggestions on fix the
bug?   the codes was so huge that i can't paste it in mail.

   Thanks a lot.

   Xiaodong.



On Fri, Jul 18, 2008 at 6:13 PM, Robert Osfield [EMAIL PROTECTED]
wrote:

 2008/7/18 Wu Xiaodong [EMAIL PROTECTED]:
  In my case, I added some new child-node to a group-node, then it crashed
  some times;
 
  Could the bug be fixed if i call osg::Group::setDataVariance ( )?

 Setting DataVariance on the Group will have no effect, it only is
 critical for StateSet and Drawable.

 It could be that your crash has nothing to do with threading though,
 and is a straight iterator invalidation issue due to your add/removing
 stuff from the scene graph.  Since I don't have your code in front of
 me I can but guess at what the cause might be.

 Robert.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Xiaodong Wu
吴晓东
'Xiao' means the time and the view when the sun rises and 'dong' means the
east in Chinese
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] crash in frame(); in the multithreading

2008-07-21 Thread Wu Xiaodong
I debug  my code once more. Your  judgment was right. In the single thread,
it crashed also.

Thanks.

Xiaodong


2008/7/22 Wu Xiaodong [EMAIL PROTECTED]:

  Based on your opinion  that the crash is *a straight iterator
 invalidation issue due to your add/removing
 stuff from the scene graph.* , can you give me some suggestions on fix
 the bug?   the codes was so huge that i can't paste it in mail.

Thanks a lot.

Xiaodong.




 On Fri, Jul 18, 2008 at 6:13 PM, Robert Osfield [EMAIL PROTECTED]
 wrote:

 2008/7/18 Wu Xiaodong [EMAIL PROTECTED]:
  In my case, I added some new child-node to a group-node, then it crashed
  some times;
 
  Could the bug be fixed if i call osg::Group::setDataVariance ( )?

 Setting DataVariance on the Group will have no effect, it only is
 critical for StateSet and Drawable.

 It could be that your crash has nothing to do with threading though,
 and is a straight iterator invalidation issue due to your add/removing
 stuff from the scene graph.  Since I don't have your code in front of
 me I can but guess at what the cause might be.

 Robert.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




 --
 Xiaodong Wu
 吴晓东
 'Xiao' means the time and the view when the sun rises and 'dong' means the
 east in Chinese




-- 
Xiaodong Wu
吴晓东
'Xiao' means the time and the view when the sun rises and 'dong' means the
east in Chinese
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] crash in frame(); in the multithreading

2008-07-18 Thread Robert Osfield
Hi Xiadong,

If you are updating StateSet/StateAttribute or Drawables/Geometry in
your update then you should mark their DataVariance to DYNAMIC so that
the draw traversal knows not to release the current frame till they
are all done.

Robert.

2008/7/18 Wu Xiaodong [EMAIL PROTECTED]:

 Hi.

   I begin a new thread for osg::Viewer()::frame();

   I create a simple scene , then call osg::Viewer::frame() ; it all
 works well;

   while I add some chilld-nodes to a group node, then it crashed in
 frame();

  Is the error generated because of the multi-thread or something;
 what should I do when insert some new children to scene to avoid this kind
 of crash?

Thanks;

  xiaodong.



 //the calling stack is as following

 osg33-osgd.dll!std::_Vector_const_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node
  ::operator++()  Line 117 + 0x33 bytesC++

 osg33-osgd.dll!std::_Vector_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node
 ::operator++()  Line 337C++
  osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor  nv={...})  Line
 60 + 0x8 bytesC++
  osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node  node={...})  Line
 181 + 0x1c bytesC++

 osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node
  node={...})  Line 84 + 0x25 bytesC++
  osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group 
 node={...})  Line 54 + 0x1a bytesC++
  osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor  nv={...})  Line 38
 + 0x41 bytesC++
  osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor  nv={...})  Line
 62 + 0x25 bytesC++
  osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node  node={...})  Line
 181 + 0x1c bytesC++

 osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node
  node={...})  Line 84 + 0x25 bytesC++
  osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group 
 node={...})  Line 54 + 0x1a bytesC++
  osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor  nv={...})  Line 38
 + 0x41 bytesC++
  osg33-osgViewerd.dll!osgViewer::Viewer::updateTraversal()  Line 837 +
 0x32 bytesC++
  osg33-osgViewerd.dll!osgViewer::ViewerBase::frame(double
 simulationTime=1.7976931348623157e+308)  Line 582 + 0xf bytesC++

 --
 Xiaodong Wu
 吴晓东
 'Xiao' means the time and the view when the sun rises and 'dong' means the
 east in Chinese

 ___
 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


Re: [osg-users] crash in frame(); in the multithreading

2008-07-18 Thread Wu Xiaodong
In my case, I added some new child-node to a group-node, then it crashed
some times;

Could the bug be fixed if i call
osg::Group::setDataVariancefile:///E:/Oil/OpenSceneGraphReferenceDocs/a01315.html#a11(
)?


   thanks.


2008/7/18 Robert Osfield [EMAIL PROTECTED]:

 Hi Xiadong,

 If you are updating StateSet/StateAttribute or Drawables/Geometry in
 your update then you should mark their DataVariance to DYNAMIC so that
 the draw traversal knows not to release the current frame till they
 are all done.

 Robert.

 2008/7/18 Wu Xiaodong [EMAIL PROTECTED]:
 
  Hi.
 
I begin a new thread for osg::Viewer()::frame();
 
I create a simple scene , then call osg::Viewer::frame() ; it
 all
  works well;
 
while I add some chilld-nodes to a group node, then it crashed
 in
  frame();
 
   Is the error generated because of the multi-thread or something;
  what should I do when insert some new children to scene to avoid this
 kind
  of crash?
 
 Thanks;
 
   xiaodong.
 
 
 
  //the calling stack is as following
 
 
 osg33-osgd.dll!std::_Vector_const_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node
   ::operator++()  Line 117 + 0x33 bytesC++
 
 
 osg33-osgd.dll!std::_Vector_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node
  ::operator++()  Line 337C++
   osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor  nv={...})
  Line
  60 + 0x8 bytesC++
   osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node  node={...})
  Line
  181 + 0x1c bytesC++
 
 
 osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node
   node={...})  Line 84 + 0x25 bytesC++
   osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group 
  node={...})  Line 54 + 0x1a bytesC++
   osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor  nv={...})  Line
 38
  + 0x41 bytesC++
   osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor  nv={...})
  Line
  62 + 0x25 bytesC++
   osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node  node={...})
  Line
  181 + 0x1c bytesC++
 
 
 osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node
   node={...})  Line 84 + 0x25 bytesC++
   osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group 
  node={...})  Line 54 + 0x1a bytesC++
   osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor  nv={...})  Line
 38
  + 0x41 bytesC++
   osg33-osgViewerd.dll!osgViewer::Viewer::updateTraversal()  Line 837
 +
  0x32 bytesC++
   osg33-osgViewerd.dll!osgViewer::ViewerBase::frame(double
  simulationTime=1.7976931348623157e+308)  Line 582 + 0xf bytesC++
 
  --
  Xiaodong Wu
  吴晓东
  'Xiao' means the time and the view when the sun rises and 'dong' means
 the
  east in Chinese
 
  ___
  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




-- 
Xiaodong Wu
吴晓东
'Xiao' means the time and the view when the sun rises and 'dong' means the
east in Chinese
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] crash in frame(); in the multithreading

2008-07-18 Thread Robert Osfield
2008/7/18 Wu Xiaodong [EMAIL PROTECTED]:
 In my case, I added some new child-node to a group-node, then it crashed
 some times;

 Could the bug be fixed if i call osg::Group::setDataVariance ( )?

Setting DataVariance on the Group will have no effect, it only is
critical for StateSet and Drawable.

It could be that your crash has nothing to do with threading though,
and is a straight iterator invalidation issue due to your add/removing
stuff from the scene graph.  Since I don't have your code in front of
me I can but guess at what the cause might be.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] crash in frame(); in the multithreading

2008-07-17 Thread Wu Xiaodong
Hi.

  I begin a new thread for osg::Viewer()::frame();

  I create a simple scene , then call osg::Viewer::frame() ; it all
works well;

  while I add some chilld-nodes to a group node, then it crashed in
frame();

 Is the error generated because of the multi-thread or something;
what should I do when insert some new children to scene to avoid this kind
of crash?

   Thanks;

 xiaodong.



//the calling stack is as following

osg33-osgd.dll!std::_Vector_const_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node
 ::operator++()  Line 117 + 0x33 bytesC++

osg33-osgd.dll!std::_Vector_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node
 ::operator++()  Line 337C++
 osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor  nv={...})  Line
60 + 0x8 bytesC++
 osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node  node={...})  Line
181 + 0x1c bytesC++

osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node
 node={...})  Line 84 + 0x25 bytesC++
 osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group 
node={...})  Line 54 + 0x1a bytesC++
 osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor  nv={...})  Line 38
+ 0x41 bytesC++
 osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor  nv={...})  Line
62 + 0x25 bytesC++
 osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node  node={...})  Line
181 + 0x1c bytesC++

osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node
 node={...})  Line 84 + 0x25 bytesC++
 osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group 
node={...})  Line 54 + 0x1a bytesC++
 osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor  nv={...})  Line 38
+ 0x41 bytesC++
 osg33-osgViewerd.dll!osgViewer::Viewer::updateTraversal()  Line 837 +
0x32 bytesC++
 osg33-osgViewerd.dll!osgViewer::ViewerBase::frame(double
simulationTime=1.7976931348623157e+308)  Line 582 + 0xf bytesC++

-- 
Xiaodong Wu
吴晓东
'Xiao' means the time and the view when the sun rises and 'dong' means the
east in Chinese
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org