From 47dfdff3c0d684e78bd72d671a0d840798076a87 Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
Date: Mon, 21 Sep 2015 20:36:21 +0300
Subject: [PATCH] MAINT-5570 limiting exposure of attachment manager

---
 indra/newview/llattachmentsmgr.cpp       | 9 +++++++++
 indra/newview/llattachmentsmgr.h         | 5 +----
 indra/newview/llavatarrendernotifier.cpp | 4 +---
 indra/newview/llvoavatar.cpp             | 2 +-
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp
index 2a137cc39b8..d3e66289d1a 100755
--- a/indra/newview/llattachmentsmgr.cpp
+++ b/indra/newview/llattachmentsmgr.cpp
@@ -421,6 +421,15 @@ void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id)
     mQuestionableCOFLinks.addTime(inv_item_id);
 }
 
+bool LLAttachmentsMgr::isAttachmentStateComplete() const
+{
+    return  mPendingAttachments.empty()
+        && mAttachmentRequests.empty()
+        && mDetachRequests.empty()
+        && mRecentlyArrivedAttachments.empty()
+        && mQuestionableCOFLinks.empty();
+}
+
 // Check for attachments that are (a) linked in COF and (b) not
 // attached to the avatar.  This is a rotten function to have to
 // include, because it runs the risk of either repeatedly spamming out
diff --git a/indra/newview/llattachmentsmgr.h b/indra/newview/llattachmentsmgr.h
index fab146cb525..bb7d35edbcb 100755
--- a/indra/newview/llattachmentsmgr.h
+++ b/indra/newview/llattachmentsmgr.h
@@ -87,10 +87,7 @@ class LLAttachmentsMgr: public LLSingleton<LLAttachmentsMgr>
     void onDetachRequested(const LLUUID& inv_item_id);
     void onDetachCompleted(const LLUUID& inv_item_id);
 
-    bool hasPendingAttachments() { return mPendingAttachments.size() > 0; }
-    bool hasAttachmentRequests() { return mAttachmentRequests.size() > 0; }
-    bool hasDetachRequests() { return mAttachmentRequests.size() > 0; }
-    bool hasRecentlyArrivedAttachments() { return mRecentlyArrivedAttachments.size() > 0; }
+    bool isAttachmentStateComplete() const;
 
 private:
 
diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp
index ca3c1a73106..53be573461e 100644
--- a/indra/newview/llavatarrendernotifier.cpp
+++ b/indra/newview/llavatarrendernotifier.cpp
@@ -191,9 +191,7 @@ void LLAvatarRenderNotifier::updateNotificationState()
 
     if (mInitialCofVersion < 0
         && gAgentWearables.areWearablesLoaded()
-        && !LLAttachmentsMgr::getInstance()->hasPendingAttachments()
-        && !LLAttachmentsMgr::getInstance()->hasAttachmentRequests()
-        && !LLAttachmentsMgr::getInstance()->hasRecentlyArrivedAttachments())
+        && LLAttachmentsMgr::getInstance()->isAttachmentStateComplete())
     {
         // cof formed
         mInitialCofVersion = LLAppearanceMgr::instance().getCOFVersion();
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 3e20fbecdbd..da02b96f807 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -6458,7 +6458,7 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading)
 	mFullyLoadedInitialized = TRUE;
 	mFullyLoadedFrameCounter++;
 
-    if (isSelf())
+    if (changed && isSelf())
     {
         // to know about outfit switching
         LLAvatarRenderNotifier::getInstance()->updateNotificationState();
-- 
GitLab