From ba9c5c366b15056ae4baf97a7d0fc0b566ffd3b6 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Mon, 30 Dec 2013 03:24:46 +0100 Subject: [PATCH] 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 --- indra/newview/llvoavatar.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ae0b13470..ea191cba4 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -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 const val(viewer_object, attachment); + if (std::find(mAttachedObjectsVector.begin(), mAttachedObjectsVector.end(), val) == mAttachedObjectsVector.end()) + { + mAttachedObjectsVector.push_back(val); + } return attachment; }