diff options
| author | Nyx (Neal Orman) <nyx@lindenlab.com> | 2012-03-20 17:31:14 -0400 | 
|---|---|---|
| committer | Nyx (Neal Orman) <nyx@lindenlab.com> | 2012-03-20 17:31:14 -0400 | 
| commit | e1a10fd81c0d20ead3b14767a8b642338389e7ed (patch) | |
| tree | 5b38f4b7e7c0e320e1d0313ac4615ea19137dabb /indra | |
| parent | bcc2547911fe6bd3ab433118dcdbfd84b3f024ec (diff) | |
SH-3040 FIX Inventory caching issues
A complete fix for a single cause of caching issues, does not solve all caching issues.
Fixes the issue of inventory links that were incorrectly being marked as broken.
Broken links get a second chance to see if their base objects exist in inventory now.
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llinventorymodel.cpp | 47 | 
1 files changed, 40 insertions, 7 deletions
| diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index a71b699fdd..2e4db6fc37 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1664,6 +1664,7 @@ bool LLInventoryModel::loadSkeleton(  		update_map_t child_counts;  		cat_array_t categories;  		item_array_t items; +		item_array_t possible_broken_links;  		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); @@ -1712,7 +1713,7 @@ bool LLInventoryModel::loadSkeleton(  				LLViewerInventoryCategory* tcat = *cit;  				// we can safely ignore anything loaded from file, but -				// not sent down in the skeleton. +				// not sent down in the skeleton. Must have been removed from inventory.  				if(cit == not_cached)  				{  					continue; @@ -1750,6 +1751,8 @@ bool LLInventoryModel::loadSkeleton(  			// Add all the items loaded which are parented to a  			// category with a correctly cached parent  			S32 bad_link_count = 0; +			S32 good_link_count = 0; +			S32 recovered_link_count = 0;  			cat_map_t::iterator unparented = mCategoryMap.end();  			for(item_array_t::const_iterator item_iter = items.begin();  				item_iter != items.end(); @@ -1766,26 +1769,56 @@ bool LLInventoryModel::loadSkeleton(  						// 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())  						{ -							bad_link_count++; +							//bad_link_count++;  							lldebugs << "Attempted to add cached link item without baseobj present ( name: "  									 << item->getName() << " itemID: " << item->getUUID()  									 << " assetID: " << item->getAssetUUID()  									 << " ).  Ignoring and invalidating " << cat->getName() << " . " << llendl; -							invalid_categories.insert(cit->second); +							possible_broken_links.push_back(item);  							continue;  						} +						else if (item->getIsLinkType()) +						{ +							good_link_count++; +						}  						addItem(item);  						cached_item_count += 1;  						++child_counts[cat->getUUID()];  					}  				}  			} -			if (bad_link_count > 0) +			if (possible_broken_links.size() > 0)  			{ -				llinfos << "Attempted to add " << bad_link_count -						<< " cached link items without baseobj present. " -						<< "The corresponding categories were invalidated." << llendl; +				for(item_array_t::const_iterator item_iter = possible_broken_links.begin(); +				    item_iter != possible_broken_links.end(); +				    ++item_iter) +				{ +					LLViewerInventoryItem *item = (*item_iter).get(); +					const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID()); +					const LLViewerInventoryCategory* cat = cit->second.get(); +					if (item->getIsBrokenLink()) +					{ +						bad_link_count++; +						invalid_categories.insert(cit->second); +						//llinfos << "link still broken: " << item->getName() << " in folder " << cat->getName() << llendl; +					} +					else +					{ +						// was marked as broken because of loading order, its actually fine to load +						addItem(item); +						cached_item_count += 1; +						++child_counts[cat->getUUID()]; +						recovered_link_count++; +					} +				} + + 				llinfos << "Attempted to add " << bad_link_count + 						<< " cached link items without baseobj present. " +					    << good_link_count << " link items were successfully added. " +					    << recovered_link_count << " links added in recovery. " + 						<< "The corresponding categories were invalidated." << llendl;  			} +  		}  		else  		{ | 
