From 9c823a1d40392dc00bdfb1f09220a5065d764f40 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 17 Nov 2009 10:33:47 -0500 Subject: 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 --- indra/newview/llagentwearables.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'indra/newview/llagentwearables.cpp') 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(data); - self->processContents(); + doOnIdle(boost::bind(&LLInitialWearablesFetch::processContents,this)); } void LLInitialWearablesFetch::processContents() -- cgit v1.2.3