summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryobserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventoryobserver.cpp')
-rw-r--r--indra/newview/llinventoryobserver.cpp35
1 files changed, 11 insertions, 24 deletions
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 2fb8aea4e9..2d9ea21b5f 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -311,10 +311,10 @@ bool LLInventoryFetchDescendentsObserver::isEverythingComplete() const
bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory* cat)
{
- const S32 version = cat->getVersion();
- const S32 expected_num_descendents = cat->getDescendentCount();
- if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) ||
- (expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN))
+ S32 version = cat->getVersion();
+ S32 descendents = cat->getDescendentCount();
+ if((LLViewerInventoryCategory::VERSION_UNKNOWN == version)
+ || (LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN == descendents))
{
return false;
}
@@ -325,28 +325,15 @@ bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory*
gInventory.getDirectDescendentsOf(cat->getUUID(), cats, items);
if(!cats || !items)
{
- llwarns << "Category '" << cat->getName() << "' descendents corrupted, fetch failed." << llendl;
- // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
- // that the cat just doesn't have any items or subfolders).
- // Unrecoverable, so just return done so that this observer can be cleared
- // from memory.
+ // bit of a hack - pretend we're done if they are gone or
+ // incomplete. should never know, but it would suck if this
+ // kept tight looping because of a corrupt memory state.
return true;
}
- const S32 current_num_known_descendents = cats->count() + items->count();
-
- // Got the number of descendents that we were expecting, so we're done.
- if (current_num_known_descendents == expected_num_descendents)
- {
- return true;
- }
-
- // Error condition, but recoverable. This happens if something was added to the
- // category before it was initialized, so accountForUpdate didn't update descendent
- // count and thus the category thinks it has fewer descendents than it actually has.
- if (current_num_known_descendents >= expected_num_descendents)
+ S32 known = cats->count() + items->count();
+ if(descendents == known)
{
- llwarns << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << llendl;
- cat->setDescendentCount(current_num_known_descendents);
+ // hey - we're done.
return true;
}
return false;
@@ -365,7 +352,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
continue;
}
if(item->isComplete())
- {
+ {
mCompleteItems.push_back(*it);
it = mIncompleteItems.erase(it);
continue;