Hi Chris,

Why not:

bool CommandManager::disconnect(Dragger& dragger)
{
     osg::ref_ptr<Dragger> localDragger(&dragger);
   _draggerSelectionMap.erase(&dragger);
   _draggerConstraintMap.erase(&dragger);  // may be deleted at this point!!!!
   return true;
}

or just:

bool CommandManager::disconnect(Dragger& dragger)
{
     if (_draggerSelectionMap.find(&dragger) != _draggerSelectionMap.end())
       _draggerSelectionMap.erase(&dragger);
if (_draggerConstraintMap.find(&dragger) != _draggerConstraintMap.end())
       _draggerConstraintMap.erase(&dragger);  // may be deleted at this 
point!!!!
   return true;
}

Then the interface doesn't change and it should be safe.

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to