From Stephan Huber, "attached you'll find a bugfix for removeTransformUpdating and another
similar remove-method. The old code removed an element from a vector, which invalidates the iterator of the loop This resulted in a crash on certain platforms. Now the erasing is done the right way without invalidating the iterator."
This commit is contained in:
@@ -182,12 +182,15 @@ void Dragger::removeConstraint(Constraint* constraint)
|
||||
{
|
||||
for(Constraints::iterator itr = _constraints.begin();
|
||||
itr != _constraints.end();
|
||||
++itr)
|
||||
)
|
||||
{
|
||||
if (*itr = constraint)
|
||||
{
|
||||
_constraints.erase(itr);
|
||||
itr = _constraints.erase(itr);
|
||||
return;
|
||||
} else
|
||||
{
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,13 +204,17 @@ void Dragger::removeTransformUpdating(osg::MatrixTransform* transform)
|
||||
{
|
||||
for(Dragger::DraggerCallbacks::iterator itr = _draggerCallbacks.begin();
|
||||
itr != _draggerCallbacks.end();
|
||||
++itr)
|
||||
)
|
||||
{
|
||||
DraggerCallback* dc = itr->get();
|
||||
DraggerTransformCallback* dtc = dynamic_cast<DraggerTransformCallback*>(dc);
|
||||
if (dtc && dtc->getTransform()==transform)
|
||||
{
|
||||
_draggerCallbacks.erase(itr);
|
||||
itr = _draggerCallbacks.erase(itr);
|
||||
}
|
||||
else
|
||||
{
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user