Compositeview:  Two views.  Big View and Little View.  Big View is loaded with 
the image of a Cessna going down in flames with the example 'Scribe' event 
handler.  Little View is the beginnings of a user interface.
   
  So based on a  pick - another view is created, populated and an eventhandler 
is attached.  Very cool.
   
  Now - based on a pick - I want to tear down said view and eventhandler.  So I 
try some variant of:
  >
  >osgViewer::View* DoomedView = viewer->getView(ViewIndex);
  >// break down the camera as much as possible.
  >DoomedView->getCamera()->setAllowEventFocus(false);
  >unsigned int DoomedChildren = DoomedView->getCamera()->getNumChildren();
  >DoomedView->getCamera()->removeChildren(0,DoomedChildren);
  >viewer->removeView(DoomedView);
  >
  in an event handler of the Little View.
   
  So I follow the process and eventually get to:  
CompositeViewer::eventTraversal()
   
  for(ViewEventsMap::iterator veitr = viewEventsMap.begin();
  veitr != viewEventsMap.end();
  ++veitr)
  {
  View* view = veitr->first;
  -->
  -->At this point in the execution 'view' is pretty thrashed - probably 
referencing the 
  --> view that no longer there???  There are no event handlers associated with 
  --> this view.  I point this out to build the drama. :)
  -->
  _eventVisitor->setActionAdapter(view);
  
  for(osgGA::EventQueue::Events::iterator itr = veitr->second.begin();
  itr != veitr->second.end();
  ++itr)
  {
  osgGA::GUIEventAdapter* event = itr->get();
  for(View::EventHandlers::iterator hitr = view->getEventHandlers().begin();
  hitr != view->getEventHandlers().end();
  ++hitr)
  -->
  --> At this point I try to wave it off: Stop!  Stop!.  There are no event 
handlers!
  --> Don't look for a begining and an end to nothing. Please!
  --> All in vain . . . 
  --> Everyone in the audience can see it coming.  Everyone in the cast and 
crew.
  --> The only one ignorant of his/her fate is the hero of the story.
  -->
  std::list
  iterator begin()
  { // return iterator for beginning of mutable sequence
  return (iterator(_Nextnode(_Myhead), this));
  }
  -->
  -->  Access violation reading address XYZ.  There is no _Nextnode of _Myhead.
  -->  I told the computer to stop but would it listen?  Oh no.  
  -->  In my despair I wonder if it would've listened to my warnings about the 
white rabbit.
  -->  Probably not - even with the supporting evidence of all the bones.
  -->
   
  Now a clever programmer like myself could simply add a check for this and 
skip over the offending check in the CompositeViewer.  I could also pour sand 
into the gears of a finely crafted clock.  I'm not in my 20's anymore, and so I 
figured I present my case and let those wiser then myself offer guidance.  That 
I learned in my 30's. :)


-Steve Schneider
       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to