Avoid duplicated entries in mAttachedObjectsVector

This fixes Top Crasher signatures 2 and 50.
http://crash.singularityviewer.org/crashes.php?signature_id=2
http://crash.singularityviewer.org/crashes.php?signature_id=50
This commit is contained in:
Aleric Inglewood
2013-12-30 03:24:46 +01:00
parent e523aadc4a
commit ba9c5c366b

View File

@@ -6295,7 +6295,12 @@ const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_o
LLSelectMgr::getInstance()->updatePointAt();
}
mAttachedObjectsVector.push_back(std::make_pair(viewer_object,attachment));
// The object can already exist in the vector if it was attached while was already attached (causing a re-attach).
std::pair<LLViewerObject*, LLViewerJointAttachment*> const val(viewer_object, attachment);
if (std::find(mAttachedObjectsVector.begin(), mAttachedObjectsVector.end(), val) == mAttachedObjectsVector.end())
{
mAttachedObjectsVector.push_back(val);
}
return attachment;
}