summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodel.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-08-18 15:34:09 +0000
committerLoren Shih <seraph@lindenlab.com>2009-08-18 15:34:09 +0000
commitac1b723fd79b63a9dab94c839d3c0acb2ddde129 (patch)
tree4da36d5bae02191ce86dea8b5b074b48f516a3ae /indra/newview/llinventorymodel.cpp
parentd53725ece11eb3403128dd77834742a1d084138f (diff)
svn merge -r130469:130817 svn+ssh://svn.lindenlab.com/svn/linden/branches/avatar-pipeline/currently-worn-folder-6 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3
This merges in all appearance side panel bug fixes.
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rw-r--r--indra/newview/llinventorymodel.cpp57
1 files changed, 31 insertions, 26 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index b27fbbff88..aadda3fbfd 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1790,7 +1790,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item)
// The item will show up as a broken link.
if (item->getIsBrokenLink())
{
- llwarns << "Add link item without baseobj present ( itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " ) " << llendl;
+ llwarns << "Add link item without baseobj present ( name: " << item->getName() << " itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << llendl;
}
mItemMap[item->getUUID()] = item;
//mInventory[item->getUUID()] = item;
@@ -2041,6 +2041,7 @@ bool LLInventoryModel::loadSkeleton(
{
cat_array_t categories;
item_array_t items;
+ cat_set_t invalid_categories; // Used to mark categories that weren't successfully loaded.
std::string owner_id_str;
owner_id.toString(owner_id_str);
std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str));
@@ -2106,7 +2107,7 @@ bool LLInventoryModel::loadSkeleton(
}
// go ahead and add the cats returned during the download
- std::set<LLUUID>::iterator not_cached_id = cached_ids.end();
+ std::set<LLUUID>::const_iterator not_cached_id = cached_ids.end();
cached_category_count = cached_ids.size();
for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
{
@@ -2126,30 +2127,28 @@ bool LLInventoryModel::loadSkeleton(
// category with a correctly cached parent
count = items.count();
cat_map_t::iterator unparented = mCategoryMap.end();
- for(int i = 0; i < count; ++i)
+ for(item_array_t::const_iterator item_iter = items.begin();
+ item_iter != items.end();
+ ++item_iter)
{
- LLViewerInventoryItem *item = items[i].get();
- cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID());
+ LLViewerInventoryItem *item = (*item_iter).get();
+ const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID());
if(cit != unparented)
{
- LLViewerInventoryCategory* cat = cit->second;
+ const LLViewerInventoryCategory* cat = cit->second.get();
if(cat->getVersion() != NO_VERSION)
{
+ // This can happen if the linked object's baseobj is removed from the cache but the linked object is still in the cache.
if (item->getIsBrokenLink())
{
llinfos << "Attempted to cached link item without baseobj present ( itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " ) " << llendl;
- child_counts[cat->getUUID()].mValue = -1; // Invalidate this category's cache.
+ invalid_categories.insert(cit->second);
continue;
}
addItem(item);
cached_item_count += 1;
-
- // If this category had any broken links, keep it invalidated.
- if (child_counts[cat->getUUID()].mValue != -1)
- {
- ++child_counts[cat->getUUID()];
- }
+ ++child_counts[cat->getUUID()];
}
}
}
@@ -2169,29 +2168,35 @@ bool LLInventoryModel::loadSkeleton(
// At this point, we need to set the known descendents for each
// category which successfully cached so that we do not
// needlessly fetch descendents for categories which we have.
- update_map_t::iterator no_child_counts = child_counts.end();
- update_map_t::iterator the_count;
+ update_map_t::const_iterator no_child_counts = child_counts.end();
for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
{
- LLViewerInventoryCategory* cat = (*it);
+ LLViewerInventoryCategory* cat = (*it).get();
if(cat->getVersion() != NO_VERSION)
{
- the_count = child_counts.find(cat->getUUID());
+ update_map_t::const_iterator the_count = child_counts.find(cat->getUUID());
if(the_count != no_child_counts)
{
- S32 num_descendents = (*the_count).second.mValue;
-
- // -1 means that one of the children was a broken link, so we can't consider this folder successfully cached.
- if (num_descendents != -1)
- {
- cat->setDescendentCount(num_descendents);
- continue;
- }
+ cat->setDescendentCount((*the_count).second.mValue);
+ }
+ else
+ {
+ cat->setDescendentCount(0);
}
- cat->setDescendentCount(0);
}
}
+ // Invalidate all categories that failed fetching descendents for whatever
+ // reason (e.g. one of the descendents was a broken link).
+ for (cat_set_t::iterator invalid_cat_it = invalid_categories.begin();
+ invalid_cat_it != invalid_categories.end();
+ invalid_cat_it++)
+ {
+ LLViewerInventoryCategory* cat = (*invalid_cat_it).get();
+ cat->setVersion(NO_VERSION);
+ llinfos << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << llendl;
+ }
+
if(remove_inventory_file)
{
// clean up the gunzipped file.