diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpathfindingobject.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llpathfindingobject.h | 19 | ||||
-rw-r--r-- | indra/newview/llpathfindingobjectlist.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llpathfindingobjectlist.h | 3 |
4 files changed, 37 insertions, 10 deletions
diff --git a/indra/newview/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp index 916eceb4c8..39fc3903b4 100644 --- a/indra/newview/llpathfindingobject.cpp +++ b/indra/newview/llpathfindingobject.cpp @@ -55,6 +55,7 @@ LLPathfindingObject::LLPathfindingObject() mOwnerUUID(), mHasOwnerName(false), mOwnerName(), + mAvatarNameCacheConnection(), mIsGroupOwned(false), mLocation() { @@ -67,6 +68,7 @@ LLPathfindingObject::LLPathfindingObject(const std::string &pUUID, const LLSD &p mOwnerUUID(), mHasOwnerName(false), mOwnerName(), + mAvatarNameCacheConnection(), mIsGroupOwned(false), mLocation() { @@ -80,6 +82,7 @@ LLPathfindingObject::LLPathfindingObject(const LLPathfindingObject& pOther) mOwnerUUID(pOther.mOwnerUUID), mHasOwnerName(false), mOwnerName(), + mAvatarNameCacheConnection(), mIsGroupOwned(pOther.mIsGroupOwned), mLocation(pOther.mLocation) { @@ -88,6 +91,7 @@ LLPathfindingObject::LLPathfindingObject(const LLPathfindingObject& pOther) LLPathfindingObject::~LLPathfindingObject() { + disconnectAvatarNameCacheConnection(); } LLPathfindingObject &LLPathfindingObject::operator =(const LLPathfindingObject& pOther) @@ -149,7 +153,7 @@ void LLPathfindingObject::fetchOwnerName() mHasOwnerName = LLAvatarNameCache::get(mOwnerUUID, &mOwnerName); if (!mHasOwnerName) { - LLAvatarNameCache::get(mOwnerUUID, boost::bind(&LLPathfindingObject::handleAvatarNameFetch, this, _1, _2)); + mAvatarNameCacheConnection = LLAvatarNameCache::get(mOwnerUUID, boost::bind(&LLPathfindingObject::handleAvatarNameFetch, this, _1, _2)); } } } @@ -159,4 +163,13 @@ void LLPathfindingObject::handleAvatarNameFetch(const LLUUID &pOwnerUUID, const llassert(mOwnerUUID == pOwnerUUID); mOwnerName = pAvatarName; mHasOwnerName = true; + disconnectAvatarNameCacheConnection(); +} + +void LLPathfindingObject::disconnectAvatarNameCacheConnection() +{ + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } } diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h index d45cc554fd..f3191053a8 100644 --- a/indra/newview/llpathfindingobject.h +++ b/indra/newview/llpathfindingobject.h @@ -32,6 +32,7 @@ #include <boost/shared_ptr.hpp> #include "llavatarname.h" +#include "llavatarnamecache.h" #include "lluuid.h" #include "v3math.h" @@ -66,15 +67,17 @@ private: void fetchOwnerName(); void handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName); + void disconnectAvatarNameCacheConnection(); - LLUUID mUUID; - std::string mName; - std::string mDescription; - LLUUID mOwnerUUID; - bool mHasOwnerName; - LLAvatarName mOwnerName; - BOOL mIsGroupOwned; - LLVector3 mLocation; + LLUUID mUUID; + std::string mName; + std::string mDescription; + LLUUID mOwnerUUID; + bool mHasOwnerName; + LLAvatarName mOwnerName; + LLAvatarNameCache::callback_connection_t mAvatarNameCacheConnection; + BOOL mIsGroupOwned; + LLVector3 mLocation; }; #endif // LL_LLPATHFINDINGOBJECT_H diff --git a/indra/newview/llpathfindingobjectlist.cpp b/indra/newview/llpathfindingobjectlist.cpp index 68a7e736e6..f1ecb45fc0 100644 --- a/indra/newview/llpathfindingobjectlist.cpp +++ b/indra/newview/llpathfindingobjectlist.cpp @@ -45,6 +45,7 @@ LLPathfindingObjectList::LLPathfindingObjectList() LLPathfindingObjectList::~LLPathfindingObjectList() { + clear(); } bool LLPathfindingObjectList::isEmpty() const @@ -52,6 +53,15 @@ bool LLPathfindingObjectList::isEmpty() const return mObjectMap.empty(); } +void LLPathfindingObjectList::clear() +{ + for (LLPathfindingObjectMap::iterator objectIter = mObjectMap.begin(); objectIter != mObjectMap.end(); ++objectIter) + { + objectIter->second.reset(); + } + mObjectMap.clear(); +} + void LLPathfindingObjectList::update(LLPathfindingObjectPtr pUpdateObjectPtr) { if (pUpdateObjectPtr != NULL) diff --git a/indra/newview/llpathfindingobjectlist.h b/indra/newview/llpathfindingobjectlist.h index 3ad8e8b096..61580582d3 100644 --- a/indra/newview/llpathfindingobjectlist.h +++ b/indra/newview/llpathfindingobjectlist.h @@ -47,6 +47,8 @@ public: bool isEmpty() const; + void clear(); + void update(LLPathfindingObjectPtr pUpdateObjectPtr); void update(LLPathfindingObjectListPtr pUpdateObjectListPtr); @@ -56,7 +58,6 @@ public: const_iterator begin() const; const_iterator end() const; - protected: LLPathfindingObjectMap &getObjectMap(); |