From b302f15deea0f4f7f5de75bfd3776c17021b6444 Mon Sep 17 00:00:00 2001
From: Steven Bennetts <steve@lindenlab.com>
Date: Fri, 1 Feb 2008 02:23:35 +0000
Subject: EFFECTIVE MERGE: maint-viewer-3 -r 77368:77381 -> release ACTUAL
 MERGE: merge maint-viewer-3-merge -r 79051 -> release

---
 doc/contributions.txt                     |   5 +
 indra/newview/linux_tools/launch_url.sh   |  14 +-
 indra/newview/linux_tools/wrapper.sh      |   6 +
 indra/newview/llagent.cpp                 |  33 +++-
 indra/newview/llhudeffecttrail.cpp        |   2 +-
 indra/newview/llinventorybridge.cpp       |  23 ++-
 indra/newview/llselectmgr.cpp             |  19 +-
 indra/newview/llstartup.cpp               |   7 +-
 indra/newview/llviewerjointattachment.cpp |  15 +-
 indra/newview/llviewermenu.cpp            |  38 ++--
 indra/newview/llviewerobjectlist.cpp      |   8 +-
 indra/newview/llvoavatar.cpp              | 319 ++++++++++++++++--------------
 indra/newview/llvoavatar.h                |   3 +-
 indra/newview/llvoicevisualizer.cpp       |   1 +
 indra/newview/pipeline.cpp                |   8 +-
 indra/newview/viewer_manifest.py          |   4 +-
 16 files changed, 313 insertions(+), 192 deletions(-)

diff --git a/doc/contributions.txt b/doc/contributions.txt
index 03a76a92fa..4dea768d28 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -52,6 +52,8 @@ Boroondas Gupte
 bushing Spatula
 	VWR-119
 	VWR-424
+Carjay McGinnis
+	VWR-3737
 Catherine Pfeffer
 	VWR-1282
 Dale Glass
@@ -166,6 +168,8 @@ McCabe Maxsted
 Michelle2 Zenovka
 	VWR-2652
 	VWR-2834
+Mm Alder
+	VWR-3777
 Mr Greggan
 	VWR-445
 Nicholaz Beresford
@@ -175,6 +179,7 @@ Nicholaz Beresford
 	VWR-349
 	VWR-353
 	VWR-364
+	VWR-374
 	VWR-546
 	VWR-691
 	VWR-727
diff --git a/indra/newview/linux_tools/launch_url.sh b/indra/newview/linux_tools/launch_url.sh
index e6450ad5ff..d2c8919d46 100755
--- a/indra/newview/linux_tools/launch_url.sh
+++ b/indra/newview/linux_tools/launch_url.sh
@@ -17,10 +17,16 @@
 URL="$1"
 
 if [ -z "$URL" ]; then
-    echo Usage: $0 URL
+    echo "Usage: $0 URL"
     exit
 fi
 
+# restore LD_LIBRARY_PATH from SAVED_LD_LIBRARY_PATH if it exists
+if [ "${SAVED_LD_LIBRARY_PATH+isset}" = "isset" ]; then
+    export LD_LIBRARY_PATH="${SAVED_LD_LIBRARY_PATH}"
+    echo "$0: Restored library path to '${SAVED_LD_LIBRARY_PATH}'"
+fi
+
 # if $BROWSER is defined, use it.
 XBROWSER=`echo "$BROWSER" |cut -f1 -d:`
 if [ ! -z "$XBROWSER" ]; then
@@ -37,8 +43,8 @@ if [ ! -z "$XBROWSER" ]; then
 	$XBROWSER "$URL" &
 	exit
     fi
-    echo "Couldn't find the browser specified by \$BROWSER ($BROWSER)"
-    echo "Trying some others..."
+    echo "$0: Couldn't find the browser specified by \$BROWSER ($BROWSER)"
+    echo "$0: Trying some others..."
 fi
 
 # else kfmclient
@@ -81,6 +87,6 @@ if which netscape >/dev/null; then
     exit
 fi
 
-echo 'Failed to find a known browser.  Please consider setting the $BROWSER environment variable.'
+echo '$0: Failed to find a known browser.  Please consider setting the $BROWSER environment variable.'
 
 # end.
diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh
index 4ed06099fc..a5cb6ae8a7 100755
--- a/indra/newview/linux_tools/wrapper.sh
+++ b/indra/newview/linux_tools/wrapper.sh
@@ -61,10 +61,16 @@ fi
 
 SCRIPTSRC=`readlink -f "$0" || echo "$0"`
 RUN_PATH=`dirname "${SCRIPTSRC}" || echo .`
+echo "Running from ${RUN_PATH}"
 cd "${RUN_PATH}"
 
 # Re-register the secondlife:// protocol handler every launch, for now.
 ./register_secondlifeprotocol.sh
+## Before we mess with LD_LIBRARY_PATH, save the old one to restore for
+##  subprocesses that care.
+if [ "${LD_LIBRARY_PATH+isset}" = "isset" ]; then
+    export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
+fi
 
 if [ -n "$LL_TCMALLOC" ]; then
     tcmalloc_libs='/usr/lib/libtcmalloc.so.0 /usr/lib/libstacktrace.so.0 /lib/libpthread.so.0'
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index f406d61a9e..51ab279e16 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3373,10 +3373,11 @@ void LLAgent::updateCamera()
 
 		mAvatarObject->mRoot.updateWorldMatrixChildren();
 
-		for(LLViewerJointAttachment *attachment = mAvatarObject->mAttachmentPoints.getFirstData();
-			attachment;
-			attachment = mAvatarObject->mAttachmentPoints.getNextData())
+		for (LLVOAvatar::attachment_map_t::iterator iter = mAvatarObject->mAttachmentPoints.begin(); 
+			 iter != mAvatarObject->mAttachmentPoints.end(); )
 		{
+			LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+			LLViewerJointAttachment* attachment = curiter->second;
 			LLViewerObject *attached_object = attachment->getObject();
 			if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull())
 			{
@@ -5749,6 +5750,19 @@ bool LLAgent::teleportCore(bool is_local)
 		return false;
 	}
 
+	// Stop all animation before actual teleporting 
+	LLVOAvatar* avatarp = gAgent.getAvatarObject();
+	if (avatarp)
+	{
+		for ( LLVOAvatar::AnimIterator anim_it= avatarp->mPlayingAnimations.begin()
+			; anim_it != avatarp->mPlayingAnimations.end()
+			; anim_it++)
+		{
+			avatarp->stopMotion(anim_it->first);
+		}
+		avatarp->processAnimationStateChanges();
+	}
+
 	// Don't call LLFirstUse::useTeleport because we don't know
 	// yet if the teleport will succeed.  Look in 
 	// process_teleport_location_reply
@@ -6830,11 +6844,10 @@ void LLAgent::makeNewOutfit(
 	{
 		BOOL msg_started = FALSE;
 		LLMessageSystem* msg = gMessageSystem;
-		S32 i;
-		for( i = 0; i < attachments_to_include.count(); i++ )
+		for( S32 i = 0; i < attachments_to_include.count(); i++ )
 		{
 			S32 attachment_pt = attachments_to_include[i];
-			LLViewerJointAttachment* attachment = mAvatarObject->mAttachmentPoints.getIfThere( attachment_pt );
+			LLViewerJointAttachment* attachment = get_if_there(mAvatarObject->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL );
 			if(!attachment) continue;
 			LLViewerObject* attached_object = attachment->getObject();
 			if(!attached_object) continue;
@@ -7454,11 +7467,11 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
 	gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
 	gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
 
-	LLViewerJointAttachment* attachment;
-	for (attachment = avatarp->mAttachmentPoints.getFirstData();
-		 attachment;
-		 attachment = avatarp->mAttachmentPoints.getNextData())
+	for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
+		 iter != avatarp->mAttachmentPoints.end(); )
 	{
+		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
 		LLViewerObject* objectp = attachment->getObject();
 		if (objectp)
 		{
diff --git a/indra/newview/llhudeffecttrail.cpp b/indra/newview/llhudeffecttrail.cpp
index dd2c155428..248ee8136e 100644
--- a/indra/newview/llhudeffecttrail.cpp
+++ b/indra/newview/llhudeffecttrail.cpp
@@ -84,7 +84,7 @@ void LLHUDEffectSpiral::markDead()
 		mPartSourcep->setDead();
 		mPartSourcep = NULL;
 	}
-	LLHUDObject::markDead();
+	LLHUDEffect::markDead();
 }
 
 void LLHUDEffectSpiral::packData(LLMessageSystem *mesgsys)
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 0c8d17e1aa..2a260f6546 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -3273,8 +3273,20 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 {
 	LLAttachmentRezAction* rez_action = new LLAttachmentRezAction;
 	rez_action->mItemID = item->getUUID();
-	rez_action->mAttachPt = gAgent.getAvatarObject()->mAttachmentPoints.reverseLookup(attachment);
-
+	S32 attach_pt = 0;
+	if (gAgent.getAvatarObject() && attachment)
+	{
+		for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin();
+			 iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter)
+		{
+			if (iter->second == attachment)
+			{
+				rez_action->mAttachPt = iter->first;
+				break;
+			}
+		}
+	}
+	rez_action->mAttachPt = attach_pt;
 	if (attachment && attachment->getObject())
 	{
 		gViewerWindow->alertXml("ReplaceAttachment", confirm_replace_attachment_rez, (void*)rez_action);
@@ -3365,10 +3377,11 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 					attach_hud_menu && (attach_hud_menu->getChildCount() == 0) &&
 					avatarp)
 				{
-					for (LLViewerJointAttachment* attachment = avatarp->mAttachmentPoints.getFirstData(); 
-						attachment;
-						attachment = gAgent.getAvatarObject()->mAttachmentPoints.getNextData())
+					for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
+						 iter != avatarp->mAttachmentPoints.end(); )
 					{
+						LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+						LLViewerJointAttachment* attachment = curiter->second;
 						LLMenuItemCallGL *new_item;
 						if (attachment->getIsHUDAttachment())
 						{
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index ddd73fc0df..511fd73ef7 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -612,6 +612,10 @@ void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_s
 		msg->addU32Fast(_PREHASH_ObjectLocalID, (objects[i])->getLocalID());
 		select_count++;
 
+		// Zap the angular velocity, as the sim will set it to zero
+		objects[i]->setAngularVelocity( 0,0,0 );
+		objects[i]->setVelocity( 0,0,0 );
+
 		if(msg->isSendFull(NULL) || select_count >= MAX_OBJECTS_PER_PACKET)
 		{
 			msg->sendReliable(regionp->getHost() );
@@ -635,6 +639,10 @@ void LLSelectMgr::deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim)
 	if (!object) return;
 	if (!object->isSelected() ) return;
 
+	// Zap the angular velocity, as the sim will set it to zero
+	object->setAngularVelocity( 0,0,0 );
+	object->setVelocity( 0,0,0 );
+
 	if (send_to_sim)
 	{
 		LLViewerRegion* region = object->getRegion();
@@ -3276,6 +3284,15 @@ void LLSelectMgr::deselectAll()
 		return;
 	}
 
+	// Zap the angular velocity, as the sim will set it to zero
+	for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+		 iter != mSelectedObjects->end(); iter++ )
+	{
+		LLViewerObject *objectp = (*iter)->getObject();
+		objectp->setAngularVelocity( 0,0,0 );
+		objectp->setVelocity( 0,0,0 );
+	}
+
 	sendListToRegions(
 		"ObjectDeselect",
 		packAgentAndSessionID,
@@ -3429,7 +3446,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point)
 	BOOL build_mode = gToolMgr->inEdit();
 	// Special case: Attach to default location for this object.
 	if (0 == attachment_point ||
-		gAgent.getAvatarObject()->mAttachmentPoints.getIfThere(attachment_point))
+		get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL))
 	{
 		sendListToRegions(
 			"ObjectAttach",
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index b50c264c35..8570055f87 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2412,8 +2412,13 @@ BOOL idle_startup()
 
 		LLStartUp::setStartupState( STATE_STARTED );
 
-		// Unmute audio if desired and setup volumes
+		// Unmute audio if desired and setup volumes.
+		// Unmute audio if desired and setup volumes.
+		// This is a not-uncommon crash site, so surround it with
+		// llinfos output to aid diagnosis.
+		llinfos << "Doing first audio_update_volume..." << llendl;
 		audio_update_volume();
+		llinfos << "Done first audio_update_volume." << llendl;
 
 		// reset keyboard focus to sane state of pointing at world
 		gFocusMgr.setKeyboardFocus(NULL);
diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp
index 186b141ff9..18c99f7453 100644
--- a/indra/newview/llviewerjointattachment.cpp
+++ b/indra/newview/llviewerjointattachment.cpp
@@ -174,7 +174,20 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object)
 	if (mAttachedObject)
 	{
 		llwarns << "Attempted to attach object where an attachment already exists!" << llendl;
-		return FALSE;
+		
+		if (mAttachedObject == object) {
+			llinfos << "(same object re-attached)" << llendl;
+			removeObject(mAttachedObject);
+			// Pass through anyway to let setupDrawable()
+			// re-connect object to the joint correctly
+		}
+		else {
+			llinfos << "(objects differ, removing existing object)" << llendl;
+			// Rather hacky, but no-one can think of something
+			// better to do for this case.
+			gObjectList.killObject(mAttachedObject);
+			// Proceed with new object attachment
+		}
 	}
 	mAttachedObject = object;
 	
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index ab82fef6cc..1825c03255 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2009,11 +2009,12 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t
 		if (gAgent.getAvatarObject())
 		{
 			LLVOAvatar* avatarp = gAgent.getAvatarObject();
-			for (LLViewerJointAttachment* attachmentp = avatarp->mAttachmentPoints.getFirstData();
-				attachmentp;
-				attachmentp = avatarp->mAttachmentPoints.getNextData())
+			for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
+				 iter != avatarp->mAttachmentPoints.end(); )
 			{
-				if (attachmentp->getObject())
+				LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+				LLViewerJointAttachment* attachment = curiter->second;
+				if (attachment->getObject())
 				{
 					new_value = true;
 					break;
@@ -5695,9 +5696,9 @@ private:
 		if (selectedObject)
 		{
 			S32 index = userdata.asInteger();
-			LLViewerJointAttachment* attachment_point = index > 0 ?
-				gAgent.getAvatarObject()->mAttachmentPoints[index] :
-				NULL;
+			LLViewerJointAttachment* attachment_point = NULL;
+			if (index > 0)
+				attachment_point = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL);
 			confirm_replace_attachment(0, attachment_point);
 		}
 		return true;
@@ -5715,10 +5716,18 @@ void near_attach_object(BOOL success, void *user_data)
 	{
 		LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
 		
-		U8 attachment_id;
+		U8 attachment_id = 0;
 		if (attachment)
 		{
-			attachment_id = gAgent.getAvatarObject()->mAttachmentPoints.reverseLookup(attachment);
+			for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin();
+				 iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter)
+			{
+				if (iter->second == attachment)
+				{
+					attachment_id = iter->first;
+					break;
+				}
+			}
 		}
 		else
 		{
@@ -5954,7 +5963,7 @@ class LLAttachmentEnableDrop : public view_listener_t
 		if ( object )
 		{
     		S32 attachmentID  = ATTACHMENT_ID_FROM_STATE(object->getState());
-  				attachment_pt = gAgent.getAvatarObject()->mAttachmentPoints.getIfThere(attachmentID);
+			attachment_pt = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
 
 			if ( attachment_pt )
 			{
@@ -6322,11 +6331,12 @@ void handle_dump_attachments(void*)
 		return;
 	}
 
-	for( LLViewerJointAttachment* attachment = avatar->mAttachmentPoints.getFirstData();
-		attachment;
-		attachment = avatar->mAttachmentPoints.getNextData() )
+	for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); 
+		 iter != avatar->mAttachmentPoints.end(); )
 	{
-		S32 key = avatar->mAttachmentPoints.getCurrentKeyWithoutIncrement();
+		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		S32 key = curiter->first;
 		BOOL visible = (attachment->getObject() != NULL &&
 						attachment->getObject()->mDrawable.notNull() && 
 						!attachment->getObject()->mDrawable->isRenderType(0));
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 38efb5de11..012bdb0843 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1157,11 +1157,11 @@ U32 LLViewerObjectList::renderObjectsForSelect(LLCamera &camera, BOOL pick_parce
 		LLVOAvatar* avatarp = gAgent.getAvatarObject();
 		if (avatarp)
 		{
-			LLViewerJointAttachment* attachmentp;
-			for (attachmentp = avatarp->mAttachmentPoints.getFirstData();
-				attachmentp;
-				attachmentp = avatarp->mAttachmentPoints.getNextData())
+			for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
+				 iter != avatarp->mAttachmentPoints.end(); )
 			{
+				LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+				LLViewerJointAttachment* attachmentp = curiter->second;
 				if (attachmentp->getIsHUDAttachment())
 				{
 					LLViewerObject* objectp = attachmentp->getObject();
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 1e800a372e..90e61426e9 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -986,7 +986,8 @@ LLVOAvatar::~LLVOAvatar()
 	delete mSkirtLayerSet;
 	mSkirtLayerSet = NULL;
 
-	mAttachmentPoints.deleteAllData();
+	std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer());
+	mAttachmentPoints.clear();
 
 	delete mTexSkinColor;
 	mTexSkinColor = NULL;
@@ -996,6 +997,7 @@ LLVOAvatar::~LLVOAvatar()
 	mTexEyeColor = NULL;
 
 	std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer());
+	mMeshes.clear();
 	
 	mDead = TRUE;
 	
@@ -1832,17 +1834,18 @@ void LLVOAvatar::buildCharacter()
 			else
 			{
 				BOOL attachment_found = FALSE;
-				for (LLViewerJointAttachment* attachment = mAttachmentPoints.getFirstData(); 
-					attachment;
-					attachment = mAttachmentPoints.getNextData())
+				for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+					 iter != mAttachmentPoints.end(); )
 				{
+					attachment_map_t::iterator curiter = iter++;
+					LLViewerJointAttachment* attachment = curiter->second;
 					if (attachment->getGroup() == i)
 					{
 						LLMenuItemCallGL* item;
 						item = new LLMenuItemCallGL(attachment->getName(), 
-							NULL, 
-							object_selected_and_point_valid);
-						item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", mAttachmentPoints.reverseLookup(attachment));
+													NULL, 
+													object_selected_and_point_valid);
+						item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first);
 						
 						gAttachPieMenu->append(item);
 
@@ -1865,10 +1868,11 @@ void LLVOAvatar::buildCharacter()
 			else
 			{
 				BOOL attachment_found = FALSE;
-				for (LLViewerJointAttachment* attachment = mAttachmentPoints.getFirstData(); 
-					attachment;
-					attachment = mAttachmentPoints.getNextData())
+				for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+					 iter != mAttachmentPoints.end(); )
 				{
+					attachment_map_t::iterator curiter = iter++;
+					LLViewerJointAttachment* attachment = curiter->second;
 					if (attachment->getGroup() == i)
 					{
 						gDetachPieMenu->append(new LLMenuItemCallGL(attachment->getName(), 
@@ -1887,17 +1891,18 @@ void LLVOAvatar::buildCharacter()
 		}
 
 		// add screen attachments
-		for (LLViewerJointAttachment* attachment = mAttachmentPoints.getFirstData(); 
-			attachment;
-			attachment = mAttachmentPoints.getNextData())
+		for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+			 iter != mAttachmentPoints.end(); )
 		{
+			attachment_map_t::iterator curiter = iter++;
+			LLViewerJointAttachment* attachment = curiter->second;
 			if (attachment->getGroup() == 8)
 			{
 				LLMenuItemCallGL* item;
 				item = new LLMenuItemCallGL(attachment->getName(), 
-					NULL, 
-					object_selected_and_point_valid);
-				item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", mAttachmentPoints.reverseLookup(attachment));
+											NULL, 
+											object_selected_and_point_valid);
+				item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first);
 				gAttachScreenPieMenu->append(item);
 				gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(), 
 							&handle_detach_from_avatar, object_attached, attachment));
@@ -1906,17 +1911,19 @@ void LLVOAvatar::buildCharacter()
 
 		for (S32 pass = 0; pass < 2; pass++)
 		{
-			for (LLViewerJointAttachment* attachment = mAttachmentPoints.getFirstData(); 
-				attachment;
-				attachment = mAttachmentPoints.getNextData())
+			for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+				 iter != mAttachmentPoints.end(); )
 			{
+				attachment_map_t::iterator curiter = iter++;
+				LLViewerJointAttachment* attachment = curiter->second;
 				if (attachment->getIsHUDAttachment() != (pass == 1))
 				{
 					continue;
 				}
 				LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), 
-					NULL, &object_selected_and_point_valid, &attach_label, attachment);
-				item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", mAttachmentPoints.reverseLookup(attachment));
+															  NULL, &object_selected_and_point_valid,
+															  &attach_label, attachment);
+				item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first);
 				gAttachSubMenu->append(item);
 
 				gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(), 
@@ -1939,26 +1946,29 @@ void LLVOAvatar::buildCharacter()
 				continue;
 			}
 
-			std::multimap<S32, LLViewerJointAttachment*> attachment_pie_menu_map;
+			std::multimap<S32, S32> attachment_pie_menu_map;
 
 			// gather up all attachment points assigned to this group, and throw into map sorted by pie slice number
-			for (LLViewerJointAttachment* attachment = mAttachmentPoints.getFirstData(); 
-				attachment;
-				attachment = mAttachmentPoints.getNextData())
+			for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+				 iter != mAttachmentPoints.end(); )
 			{
+				attachment_map_t::iterator curiter = iter++;
+				LLViewerJointAttachment* attachment = curiter->second;
 				if(attachment->getGroup() == group)
 				{
 					// use multimap to provide a partial order off of the pie slice key
-					attachment_pie_menu_map.insert(std::pair<S32, LLViewerJointAttachment*>(attachment->getPieSlice(), attachment));
+					S32 pie_index = attachment->getPieSlice();
+					attachment_pie_menu_map.insert(std::make_pair(pie_index, curiter->first));
 				}
 			}
 
 			// add in requested order to pie menu, inserting separators as necessary
-			std::multimap<S32, LLViewerJointAttachment*>::iterator attach_it;
 			S32 cur_pie_slice = 0;
-			for (attach_it = attachment_pie_menu_map.begin(); attach_it != attachment_pie_menu_map.end(); ++attach_it)
+			for (std::multimap<S32, S32>::iterator attach_it = attachment_pie_menu_map.begin();
+				 attach_it != attachment_pie_menu_map.end(); ++attach_it)
 			{
 				S32 requested_pie_slice = attach_it->first;
+				S32 attach_index = attach_it->second;
 				while (cur_pie_slice < requested_pie_slice)
 				{
 					gAttachBodyPartPieMenus[group]->appendSeparator();
@@ -1966,16 +1976,18 @@ void LLVOAvatar::buildCharacter()
 					cur_pie_slice++;
 				}
 
-				LLViewerJointAttachment* attachment = attach_it->second;
-
-				LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), 
-					NULL, object_selected_and_point_valid);
-				gAttachBodyPartPieMenus[group]->append(item);
-				item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", mAttachmentPoints.reverseLookup(attachment));
-				gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(), 
-					&handle_detach_from_avatar, object_attached, attachment));
-
-				cur_pie_slice++;
+				LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL);
+				if (attachment)
+				{
+					LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), 
+																  NULL, object_selected_and_point_valid);
+					gAttachBodyPartPieMenus[group]->append(item);
+					item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index);
+					gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(), 
+																				&handle_detach_from_avatar,
+																				object_attached, attachment));
+					cur_pie_slice++;
+				}
 			}
 		}
 	}
@@ -2015,13 +2027,14 @@ void LLVOAvatar::releaseMeshData()
 		facep->setSize(0, 0);
 	}
 	
-	for (LLViewerJointAttachment *attachmentPoint = mAttachmentPoints.getFirstData();
-		attachmentPoint;
-		attachmentPoint = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
 	{
-		if (!attachmentPoint->getIsHUDAttachment())
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		if (!attachment->getIsHUDAttachment())
 		{
-			attachmentPoint->setAttachmentVisibility(FALSE);
+			attachment->setAttachmentVisibility(FALSE);
 		}
 	}
 	mMeshValid = FALSE;
@@ -2044,13 +2057,14 @@ void LLVOAvatar::restoreMeshData()
 	}
 	else
 	{
-		for (LLViewerJointAttachment *attachmentPoint = mAttachmentPoints.getFirstData();
-			attachmentPoint;
-			attachmentPoint = mAttachmentPoints.getNextData())
+		for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+			 iter != mAttachmentPoints.end(); )
 		{
-			if (!attachmentPoint->getIsHUDAttachment())
+			attachment_map_t::iterator curiter = iter++;
+			LLViewerJointAttachment* attachment = curiter->second;
+			if (!attachment->getIsHUDAttachment())
 			{
-				attachmentPoint->setAttachmentVisibility(TRUE);
+				attachment->setAttachmentVisibility(TRUE);
 			}
 		}
 	}
@@ -2435,10 +2449,11 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 	// update attachments positions
 	{
 		LLFastTimer t(LLFastTimer::FTM_ATTACHMENT_UPDATE);
-		for(LLViewerJointAttachment *attachment = mAttachmentPoints.getFirstData();
-			attachment;
-			attachment = mAttachmentPoints.getNextData())
+		for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+			 iter != mAttachmentPoints.end(); )
 		{
+			attachment_map_t::iterator curiter = iter++;
+			LLViewerJointAttachment* attachment = curiter->second;
 			LLViewerObject *attached_object = attachment->getObject();
 
 			BOOL visibleAttachment = isVisible() || !(attached_object && attached_object->mDrawable->getSpatialBridge()
@@ -3593,10 +3608,11 @@ void LLVOAvatar::updateVisibility(BOOL force_invisible)
 			llinfos << "PA: " << getPositionAgent() << llendl;
 			/*llinfos << "SPA: " << sel_pos_agent << llendl;
 			llinfos << "WPA: " << wrist_right_pos_agent << llendl;*/
-			for (LLViewerJointAttachment* attachment = mAttachmentPoints.getFirstData(); 
-				attachment;
-				attachment = mAttachmentPoints.getNextData())
+			for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+				 iter != mAttachmentPoints.end(); )
 			{
+				attachment_map_t::iterator curiter = iter++;
+				LLViewerJointAttachment* attachment = curiter->second;
 				if (attachment->getObject())
 				{
 					if(attachment->getObject()->mDrawable->isVisible())
@@ -5103,7 +5119,7 @@ BOOL LLVOAvatar::loadSkeletonNode ()
 				delete attachment;
 				continue;
 			}
-			if (mAttachmentPoints.checkData(attachmentID))
+			if (mAttachmentPoints.find(attachmentID) != mAttachmentPoints.end())
 			{
 				llwarns << "Attachment point redefined with id " << attachmentID << " on attachment point " << info->mName << llendl;
 				delete attachment;
@@ -5768,7 +5784,7 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi
 {
 	S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState());
 
-	LLViewerJointAttachment* attachment = mAttachmentPoints.getIfThere(attachmentID);
+	LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
 
 	if (!attachment)
 	{
@@ -5813,27 +5829,29 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object)
 //-----------------------------------------------------------------------------
 void LLVOAvatar::lazyAttach()
 {
-	for(LLViewerJointAttachment* attachment = mAttachmentPoints.getFirstData();
-		attachment;
-		attachment = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
+	{
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		if (attachment->getAttachmentDirty())
 		{
-			if (attachment->getAttachmentDirty())
+			attachment->lazyAttach();
+			if (mIsSelf)
 			{
-				attachment->lazyAttach();
-				if (mIsSelf)
-				{
-					updateAttachmentVisibility(gAgent.getCameraMode());
-				}
+				updateAttachmentVisibility(gAgent.getCameraMode());
 			}
 		}
+	}
 }
 
 void LLVOAvatar::resetHUDAttachments()
 {
-	for(LLViewerJointAttachment* attachment = mAttachmentPoints.getFirstData();
-		attachment;
-		attachment = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
 	{
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
 		if (attachment->getIsHUDAttachment())
 		{
 			LLViewerObject* obj = attachment->getObject();
@@ -5850,10 +5868,11 @@ void LLVOAvatar::resetHUDAttachments()
 //-----------------------------------------------------------------------------
 BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
 {
-	for(LLViewerJointAttachment* attachment = mAttachmentPoints.getFirstData();
-		attachment;
-		attachment = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
 	{
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
 		// only one object per attachment point for now
 		if (attachment->getObject() == viewer_object)
 		{
@@ -5862,7 +5881,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
 			if (mIsSelf)
 			{
 				// the simulator should automatically handle
-				// permissiosn revokation
+				// permission revocation
 
 				stopMotionFromSource(viewer_object->getID());
 				LLFollowCamMgr::setCameraActive(viewer_object->getID(), FALSE);
@@ -5871,7 +5890,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
 				{
 					LLViewerObject* child_objectp = viewer_object->mChildList[i];
 					// the simulator should automatically handle
-					// permissions revokation
+					// permissions revocation
 
 					stopMotionFromSource(child_objectp->getID());
 					LLFollowCamMgr::setCameraActive(child_objectp->getID(), FALSE);
@@ -6025,11 +6044,12 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj )
 //-----------------------------------------------------------------------------
 BOOL LLVOAvatar::isWearingAttachment( const LLUUID& inv_item_id )
 {
-	for (LLViewerJointAttachment *attachment_point = mAttachmentPoints.getFirstData();
-		attachment_point;
-		attachment_point = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
 	{
-		if( attachment_point->getItemID() == inv_item_id )
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		if( attachment->getItemID() == inv_item_id )
 		{
 			return TRUE;
 		}
@@ -6042,13 +6062,14 @@ BOOL LLVOAvatar::isWearingAttachment( const LLUUID& inv_item_id )
 //-----------------------------------------------------------------------------
 LLViewerObject* LLVOAvatar::getWornAttachment( const LLUUID& inv_item_id )
 {
-	for (LLViewerJointAttachment *attachment_point = mAttachmentPoints.getFirstData();
-		attachment_point;
-		attachment_point = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
 	{
-		if( attachment_point->getItemID() == inv_item_id )
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		if( attachment->getItemID() == inv_item_id )
 		{
-			return attachment_point->getObject();
+			return attachment->getObject();
 		}
 	}
 	return NULL;
@@ -6056,13 +6077,14 @@ LLViewerObject* LLVOAvatar::getWornAttachment( const LLUUID& inv_item_id )
 
 const LLString LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id)
 {
-	for (LLViewerJointAttachment *attachment_point = mAttachmentPoints.getFirstData();
-		attachment_point;
-		attachment_point = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
 	{
-		if( attachment_point->getItemID() == inv_item_id )
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		if( attachment->getItemID() == inv_item_id )
 		{
-			return (LLString)attachment_point->getName();
+			return (LLString)attachment->getName();
 		}
 	}
 
@@ -7617,30 +7639,31 @@ void LLVOAvatar::dumpAvatarTEs( const char* context )
 //-----------------------------------------------------------------------------
 void LLVOAvatar::updateAttachmentVisibility(U32 camera_mode)
 {
-	for (LLViewerJointAttachment *attachmentPoint = mAttachmentPoints.getFirstData();
-		attachmentPoint;
-		attachmentPoint = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
 	{
-		if (attachmentPoint->getIsHUDAttachment())
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		if (attachment->getIsHUDAttachment())
 		{
-			attachmentPoint->setAttachmentVisibility(TRUE);
+			attachment->setAttachmentVisibility(TRUE);
 		}
 		else
 		{
 			switch (camera_mode)
 			{
 			case CAMERA_MODE_MOUSELOOK:
-				if (LLVOAvatar::sVisibleInFirstPerson && attachmentPoint->getVisibleInFirstPerson())
+				if (LLVOAvatar::sVisibleInFirstPerson && attachment->getVisibleInFirstPerson())
 				{
-					attachmentPoint->setAttachmentVisibility(TRUE);
+					attachment->setAttachmentVisibility(TRUE);
 				}
 				else
 				{
-					attachmentPoint->setAttachmentVisibility(FALSE);
+					attachment->setAttachmentVisibility(FALSE);
 				}
 				break;
 			default:
-				attachmentPoint->setAttachmentVisibility(TRUE);
+				attachment->setAttachmentVisibility(TRUE);
 				break;
 			}
 		}
@@ -7789,39 +7812,45 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type )
 //-----------------------------------------------------------------------------
 void LLVOAvatar::clampAttachmentPositions()
 {
-	if (isDead()) return;
-	for(LLViewerJointAttachment *attachment = mAttachmentPoints.getFirstData();
-		attachment;
-		attachment = mAttachmentPoints.getNextData())
+	if (isDead())
+	{
+		return;
+	}
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
+	{
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		if (attachment)
 		{
-			if (attachment)
-			{
-				attachment->clampObjectPosition();
-			}
+			attachment->clampObjectPosition();
 		}
+	}
 }
 
 BOOL LLVOAvatar::hasHUDAttachment()
 {
-	for(LLViewerJointAttachment *attachment = mAttachmentPoints.getFirstData();
-		attachment;
-		attachment = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
+	{
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		if (attachment->getIsHUDAttachment() && attachment->getObject())
 		{
-			if (attachment->getIsHUDAttachment() && attachment->getObject())
-			{
-				return TRUE;
-			}
+			return TRUE;
 		}
+	}
 	return FALSE;
 }
 
 LLBBox LLVOAvatar::getHUDBBox()
 {
 	LLBBox bbox;
-	for(LLViewerJointAttachment *attachment = mAttachmentPoints.getFirstData();
-	attachment;
-	attachment = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
 	{
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
 		if (attachment->getIsHUDAttachment() && attachment->getObject())
 		{
 			LLViewerObject* hud_object = attachment->getObject();
@@ -9237,48 +9266,50 @@ void LLVOAvatar::writeCAL3D(std::string& path, std::string& file_base)
 	std::multimap<LLUUID, LLMaterialExportInfo*> material_map;
 
 	S32 num_attachment_objects = 0;
-	for(LLViewerJointAttachment *attachment = mAttachmentPoints.getFirstData();
-		attachment;
-		attachment = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
+	{
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		LLViewerObject *attached_object = attachment->getObject();
+		if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull() &&
+			attached_object->getPCode() == LL_PCODE_VOLUME)
 		{
-			LLViewerObject *attached_object = attachment->getObject();
-			if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull() &&
-				attached_object->getPCode() == LL_PCODE_VOLUME)
+			num_attachment_objects += attached_object->mDrawable->getNumFaces(); 
+			for (U32 i = 0; i < attached_object->mChildList.size(); i++)
 			{
-				num_attachment_objects += attached_object->mDrawable->getNumFaces(); 
-				for (U32 i = 0; i < attached_object->mChildList.size(); i++)
-				{
-					LLViewerObject* child_object = attached_object->mChildList[i];
-					num_attachment_objects += child_object->mDrawable->getNumFaces();
-				}
+				LLViewerObject* child_object = attached_object->mChildList[i];
+				num_attachment_objects += child_object->mDrawable->getNumFaces();
 			}
 		}
+	}
 
 	apr_file_printf(fp, "<MESH VERSION=\"1000\" NUMSUBMESH=\"%d\">\n", num_attachment_objects);
 
 	S32 material_index = 6;
 	S32 texture_index = 6;
-	for(LLViewerJointAttachment *attachment = mAttachmentPoints.getFirstData();
-		attachment;
-		attachment = mAttachmentPoints.getNextData())
+	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 
+		 iter != mAttachmentPoints.end(); )
+	{
+		attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		LLViewerObject *attached_object = attachment->getObject();
+		if (attached_object && !attached_object->isDead() && attached_object->getPCode() == LL_PCODE_VOLUME)
 		{
-			LLViewerObject *attached_object = attachment->getObject();
-			if (attached_object && !attached_object->isDead() && attached_object->getPCode() == LL_PCODE_VOLUME)
+			LLVOVolume* attached_volume = (LLVOVolume*)attached_object;
+			LLVector3 pos = attachment->getPosition();
+			LLJoint* cur_joint = attachment->getParent();
+			while (cur_joint)
 			{
-				LLVOVolume* attached_volume = (LLVOVolume*)attached_object;
-				LLVector3 pos = attachment->getPosition();
-				LLJoint* cur_joint = attachment->getParent();
-				while (cur_joint)
-				{
-					pos += cur_joint->getSkinOffset();
-					cur_joint = (LLViewerJoint*)cur_joint->getParent();
-				}
-				pos *= 100.f;
-				S32 attached_joint_num = attachment->getParent()->mJointNum;
-				LLQuaternion rot = attachment->getRotation();
-				attached_volume->writeCAL3D(fp, path, file_base, attached_joint_num, pos, rot, material_index, texture_index, material_map);
+				pos += cur_joint->getSkinOffset();
+				cur_joint = (LLViewerJoint*)cur_joint->getParent();
 			}
+			pos *= 100.f;
+			S32 attached_joint_num = attachment->getParent()->mJointNum;
+			LLQuaternion rot = attachment->getRotation();
+			attached_volume->writeCAL3D(fp, path, file_base, attached_joint_num, pos, rot, material_index, texture_index, material_map);
 		}
+	}
 	apr_file_printf(fp, "</MESH>\n");
 	apr_file_close(fp);
 
@@ -9378,7 +9409,7 @@ void LLVOAvatar::writeCAL3D(std::string& path, std::string& file_base)
 // warning: order(N) not order(1)
 S32 LLVOAvatar::getAttachmentCount()
 {
-	S32 count = mAttachmentPoints.getLength();
+	S32 count = mAttachmentPoints.size();
 	return count;
 }
 
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 7ef9aee873..6f262a730a 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -845,7 +845,8 @@ public:
 	static S32 sScratchTexBytes;
 
 	// map of attachment points, by ID
-	LLPtrSkipMap<S32, LLViewerJointAttachment*> mAttachmentPoints;
+	typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t;
+	attachment_map_t mAttachmentPoints;
 
 	// xml parse tree of avatar config file
 	static LLXmlTree sXMLTree;
diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp
index 39f2f63066..96026c58ba 100644
--- a/indra/newview/llvoicevisualizer.cpp
+++ b/indra/newview/llvoicevisualizer.cpp
@@ -451,6 +451,7 @@ void LLVoiceVisualizer::markDead()
 	mVoiceEnabled			= false;
 	mSoundSymbol.mActive	= false;
 
+	LLHUDEffect::markDead();
 }//------------------------------------------------------------------
 
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index b16a9fb02b..0f17310840 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -2393,11 +2393,11 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects)
 		glPushMatrix();
 
 		setup_hud_matrices(TRUE);
-		LLViewerJointAttachment* attachmentp;
-		for (attachmentp = avatarp->mAttachmentPoints.getFirstData();
-			attachmentp;
-			attachmentp = avatarp->mAttachmentPoints.getNextData())
+		for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
+			 iter != avatarp->mAttachmentPoints.end(); )
 		{
+			LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+			LLViewerJointAttachment* attachmentp = curiter->second;
 			if (attachmentp->getIsHUDAttachment())
 			{
 				LLViewerObject* objectp = attachmentp->getObject();
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 6acaabe028..13a8c087b0 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -445,7 +445,7 @@ class LinuxManifest(ViewerManifest):
         def construct(self):
                 super(LinuxManifest, self).construct()
                 self.path("licenses-linux.txt","licenses.txt")
-                self.path("res/ll_icon.ico","secondlife.ico")
+                #self.path("res/ll_icon.ico","secondlife.ico")
                 if self.prefix("linux_tools", ""):
                         self.path("client-readme.txt","README-linux.txt")
                         self.path("client-readme-voice.txt","README-linux-voice.txt")
@@ -495,7 +495,7 @@ class Linux_i686Manifest(LinuxManifest):
                         self.end_prefix("res-sdl")
 
                 self.path("featuretable_linux.txt")
-                self.path("secondlife-i686.supp")
+                #self.path("secondlife-i686.supp")
 
                 self.path("app_settings/mozilla-runtime-linux-i686")
 
-- 
cgit v1.2.3