diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2009-11-17 10:33:47 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2009-11-17 10:33:47 -0500 |
commit | 9c823a1d40392dc00bdfb1f09220a5065d764f40 (patch) | |
tree | 5c82a05913786b0401f30a94b40d9c1e4a44bd51 /indra/newview/llagentwearables.cpp | |
parent | 6f52f1e502cf030ceb4e14963fdda1021ea33023 (diff) |
Deferring work to idle time to avoid recursive notifyObservers calls - added wrapper class to defer an arbitrary boost::bind or other callable
--HG--
branch : avatar-pipeline
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rw-r--r-- | indra/newview/llagentwearables.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 17e7eea2f1..a171f75b17 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -62,7 +62,7 @@ class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver { public: LLInitialWearablesFetch() {} - ~LLInitialWearablesFetch() {} + ~LLInitialWearablesFetch(); virtual void done(); struct InitialWearableData @@ -84,7 +84,6 @@ public: protected: void processWearablesMessage(); void processContents(); - static void onIdle(void *userdata); }; LLAgentWearables gAgentWearables; @@ -2013,6 +2012,11 @@ void LLAgentWearables::updateServer() // to avoid gInventory.notifyObservers recursion. //-------------------------------------------------------------------- +LLInitialWearablesFetch::~LLInitialWearablesFetch() +{ + llinfos << "~LLInitialWearablesFetch" << llendl; +} + // virtual void LLInitialWearablesFetch::done() { @@ -2020,15 +2024,7 @@ void LLInitialWearablesFetch::done() // gInventory.notifyObservers. The results will be handled in the next // idle tick instead. gInventory.removeObserver(this); - gIdleCallbacks.addFunction(onIdle, this); -} - -// static -void LLInitialWearablesFetch::onIdle(void *data) -{ - gIdleCallbacks.deleteFunction(onIdle, data); - LLInitialWearablesFetch *self = reinterpret_cast<LLInitialWearablesFetch*>(data); - self->processContents(); + doOnIdle(boost::bind(&LLInitialWearablesFetch::processContents,this)); } void LLInitialWearablesFetch::processContents() |