diff --git a/indra/llcommon/aithreadsafe.h b/indra/llcommon/aithreadsafe.h
index 3963281cb..52c4ac8d2 100644
--- a/indra/llcommon/aithreadsafe.h
+++ b/indra/llcommon/aithreadsafe.h
@@ -403,7 +403,8 @@ protected:
// Locking control.
LLMutex mMutex;
- // For use by AIThreadSafeSimpleDC
+ friend struct AIRegisteredStateMachinesList;
+ // For use by AIThreadSafeSimpleDC and AIRegisteredStateMachinesList.
AIThreadSafeSimple(void) { }
AIThreadSafeSimple(AIAPRPool& parent) : mMutex(parent) { }
diff --git a/indra/newview/llhudeffectlookat.h b/indra/newview/llhudeffectlookat.h
index 922c718f6..97de0e8ba 100644
--- a/indra/newview/llhudeffectlookat.h
+++ b/indra/newview/llhudeffectlookat.h
@@ -34,6 +34,7 @@
#define LL_LLHUDEFFECTLOOKAT_H
#include "llhudeffect.h"
+#include "llframetimer.h"
class LLViewerObject;
class LLVOAvatar;
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 910d94baf..1cc9393d7 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -59,6 +59,7 @@
#include "llviewercontrol.h"
#include "llvoavatar.h"
#include "llsdutil.h"
+#include "statemachine/aievent.h"
//
#include "llappviewer.h" // gLostItemsRoot
//
@@ -349,6 +350,13 @@ void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id,
items = get_ptr_in_map(mParentChildItemTree, cat_id);
}
+// Same but just categories.
+void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id,
+ cat_array_t*& categories) const
+{
+ categories = get_ptr_in_map(mParentChildCategoryTree, cat_id);
+}
+
// SJB: Added version to lock the arrays to catch potential logic bugs
void LLInventoryModel::lockDirectDescendentArrays(const LLUUID& cat_id,
cat_array_t*& categories,
@@ -1727,7 +1735,6 @@ void LLInventoryModel::startBackgroundFetch(const LLUUID& cat_id)
{
if (!sAllFoldersFetched)
{
- sBackgroundFetchActive = TRUE;
if (cat_id.isNull())
{
if (!sFullFetchStarted)
@@ -1735,15 +1742,29 @@ void LLInventoryModel::startBackgroundFetch(const LLUUID& cat_id)
sFullFetchStarted = TRUE;
sFetchQueue.push_back(gInventoryLibraryRoot);
sFetchQueue.push_back(gAgent.getInventoryRootID());
- gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
+ if (!sBackgroundFetchActive)
+ {
+ sBackgroundFetchActive = TRUE;
+ gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
+ }
}
}
else
{
// specific folder requests go to front of queue
- if (sFetchQueue.empty() || sFetchQueue.front() != cat_id)
+ // Remove it from the queue first, to avoid getting it twice.
+ if (!sFetchQueue.empty() && sFetchQueue.front() != cat_id)
{
- sFetchQueue.push_front(cat_id);
+ std::deque::iterator old_entry = std::find(sFetchQueue.begin(), sFetchQueue.end(), cat_id);
+ if (old_entry != sFetchQueue.end())
+ {
+ sFetchQueue.erase(old_entry);
+ }
+ }
+ sFetchQueue.push_front(cat_id);
+ if (!sBackgroundFetchActive)
+ {
+ sBackgroundFetchActive = TRUE;
gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
}
}
@@ -1753,9 +1774,12 @@ void LLInventoryModel::startBackgroundFetch(const LLUUID& cat_id)
//static
void LLInventoryModel::findLostItems()
{
- sBackgroundFetchActive = TRUE;
sFetchQueue.push_back(LLUUID::null);
- gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
+ if (!sBackgroundFetchActive)
+ {
+ sBackgroundFetchActive = TRUE;
+ gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
+ }
}
//static
@@ -1767,7 +1791,11 @@ void LLInventoryModel::stopBackgroundFetch()
gIdleCallbacks.deleteFunction(&LLInventoryModel::backgroundFetch, NULL);
sBulkFetchCount=0;
sMinTimeBetweenFetches=0.0f;
-// sFullFetchStarted=FALSE;
+ if (!sAllFoldersFetched)
+ {
+ // We didn't finish this, so set it to FALSE in order to be able to start it again.
+ sFullFetchStarted=FALSE;
+ }
}
}
@@ -2941,6 +2969,7 @@ void LLInventoryModel::buildParentChildMap()
// root of the agent's inv found.
// The inv tree is built.
mIsAgentInvUsable = true;
+ AIEvent::trigger(AIEvent::LLInventoryModel_mIsAgentInvUsable_true);
}
}
llinfos << " finished buildParentChildMap " << llendl;
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 6fdb59d1a..a6dc0f31a 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -38,6 +38,7 @@
#include "lluuid.h"
#include "llpermissionsflags.h"
#include "llstring.h"
+#include "llhttpclient.h"
#include