diff options
author | Kitty Barnett <develop@catznip.com> | 2012-12-12 21:47:24 +0100 |
---|---|---|
committer | Kitty Barnett <develop@catznip.com> | 2012-12-12 21:47:24 +0100 |
commit | a18ea9d92923e331c0a3e179e126659e694b1c07 (patch) | |
tree | ac82c05ccab33639a24bd661e8edf602d7912bb4 /indra | |
parent | ef301c59832025240a20f9959008a33dc52233f9 (diff) |
Clean up pending requests when regions are removed from LLWorld
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llmaterialmgr.cpp | 25 | ||||
-rw-r--r-- | indra/newview/llmaterialmgr.h | 3 | ||||
-rw-r--r-- | indra/newview/llworld.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llworld.h | 5 |
4 files changed, 41 insertions, 1 deletions
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index f623ca11ec..1daeedb8b0 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -112,6 +112,7 @@ void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason) LLMaterialMgr::LLMaterialMgr() { gIdleCallbacks.addFunction(&LLMaterialMgr::onIdle, NULL); + LLWorld::instance().setRegionRemovedCallback(boost::bind(&LLMaterialMgr::onRegionRemoved, this, _1)); } LLMaterialMgr::~LLMaterialMgr() @@ -607,3 +608,27 @@ void LLMaterialMgr::processPutQueue() } } } + +void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp) +{ + const LLUUID& region_id = regionp->getRegionID(); + + // Get + mGetQueue.erase(region_id); + for (get_pending_map_t::const_iterator itPending = mGetPending.begin(); itPending != mGetPending.end();) + { + if (region_id == itPending->first.first) + mGetPending.erase(itPending++); + else + ++itPending; + } + + // Get all + mGetAllQueue.erase(region_id); + mGetAllRequested.erase(region_id); + mGetAllPending.erase(region_id); + mGetAllCallbacks.erase(region_id); + + // Put +// mPutQueue.erase(region_id); +} diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index 1066f3ef37..5a0064ae27 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -31,6 +31,8 @@ #include "llmaterialid.h" #include "llsingleton.h" +class LLViewerRegion; + class LLMaterialMgr : public LLSingleton<LLMaterialMgr> { friend LLSingleton<LLMaterialMgr>; @@ -61,6 +63,7 @@ protected: void onGetAllResponse(bool success, const LLSD& content, const LLUUID& region_id); void processPutQueue(); void onPutResponse(bool success, const LLSD& content); + void onRegionRemoved(LLViewerRegion* regionp); protected: typedef std::set<LLMaterialID> material_queue_t; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index ed6c8bd32b..604f7f2b56 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -275,7 +275,9 @@ void LLWorld::removeRegion(const LLHost &host) mActiveRegionList.remove(regionp); mCulledRegionList.remove(regionp); mVisibleRegionList.remove(regionp); - + + mRegionRemovedSignal(regionp); + delete regionp; updateWaterObjects(); @@ -1259,6 +1261,11 @@ bool LLWorld::isRegionListed(const LLViewerRegion* region) const return it != mRegionList.end(); } +boost::signals2::connection LLWorld::setRegionRemovedCallback(const region_remove_signal_t::slot_type& cb) +{ + return mRegionRemovedSignal.connect(cb); +} + LLHTTPRegistration<LLEstablishAgentCommunication> gHTTPRegistrationEstablishAgentCommunication( "/message/EstablishAgentCommunication"); diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index 72f2ac46da..d0b001ba44 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -150,6 +150,9 @@ public: typedef std::list<LLViewerRegion*> region_list_t; const region_list_t& getRegionList() const { return mActiveRegionList; } + typedef boost::signals2::signal<void(LLViewerRegion*)> region_remove_signal_t; + boost::signals2::connection setRegionRemovedCallback(const region_remove_signal_t::slot_type& cb); + // Returns lists of avatar IDs and their world-space positions within a given distance of a point. // All arguments are optional. Given containers will be emptied and then filled. // Not supplying origin or radius input returns data on all avatars in the known regions. @@ -169,6 +172,8 @@ private: region_list_t mVisibleRegionList; region_list_t mCulledRegionList; + region_remove_signal_t mRegionRemovedSignal; + // Number of points on edge static const U32 mWidth; |