From 8ea12297e2e757ad6efbeaebd3ee86c0605ce385 Mon Sep 17 00:00:00 2001 From: angela Date: Mon, 9 Nov 2009 13:34:32 +0800 Subject: escape from infinitive loop of fetching inventory folder with NULL uuid --- indra/newview/llinventorymodel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index baf34b42ff..c8b9841e5d 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1267,6 +1267,8 @@ void LLInventoryModel::fetchInventoryResponder::error(U32 status, const std::str bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) { + if(folder_id.isNull()) return false; + LLViewerInventoryCategory* cat = getCategory(folder_id); if(!cat) { -- cgit v1.2.3 From a54192db4bcdb8f0241c9c1082c5228d1694887c Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 9 Nov 2009 16:57:17 -0500 Subject: For EXT-2335 Diagnose warning spam: "LLInventoryPanel::buildNewViews called with invalid objectp->mType" Trivial fix to just ignore reading in items that have unknown/none asset type. --- indra/newview/llinventorymodel.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index baf34b42ff..b41695fd34 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1823,17 +1823,25 @@ void LLInventoryModel::addCategory(LLViewerInventoryCategory* category) void LLInventoryModel::addItem(LLViewerInventoryItem* item) { //llinfos << "LLInventoryModel::addItem()" << llendl; + + + // This can happen if assettype enums change. This can be a backwards compatibility issue + // in some viewer prototypes prior to when the AT_LINK enum changed from 23 to 24. + if ((item->getType() == LLAssetType::AT_NONE) + || LLAssetType::lookup(item->getType()) == LLAssetType::badLookup()) + { + llwarns << "Got bad asset type for item ( name: " << item->getName() << " type: " << item->getType() << " inv-type: " << item->getInventoryType() << " ), ignoring." << llendl; + return; + } if(item) { // This condition means that we tried to add a link without the baseobj being in memory. // The item will show up as a broken link. if (item->getIsBrokenLink()) { - llwarns << "Add link item without baseobj present ( name: " << item->getName() << " itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << llendl; -// llassert_always(FALSE); // DO NOT MERGE THIS IN. This is an AVP debugging line. If this line triggers, it means that you just loaded in a broken link. Unless that happens because you actually deleted a baseobj without deleting the link, it's indicative of a serious problem (likely with your inventory) and should be diagnosed. + llinfos << "Adding broken link ( name: " << item->getName() << " itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << llendl; } mItemMap[item->getUUID()] = item; - //mInventory[item->getUUID()] = item; } } @@ -2175,7 +2183,7 @@ 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()) { - llinfos << "Attempted to cached link item without baseobj present ( itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " ) " << llendl; + llinfos << "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); continue; } -- cgit v1.2.3 From 1d4a6d144111100d30eaefb96ed632f1d8a11dc5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 9 Nov 2009 17:01:08 -0500 Subject: For EXT-2325: Should purge inventory cache moving from 1.23 to 2.0. Added a version field at the beginning of inventory cache files. If version field is not found or does not match expectected value, then the cache is discarded. In 1.23, the version line triggers a warning but is otherwise ignored. Reviewed by Seraph. --- indra/newview/llinventorymodel.cpp | 47 ++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index baf34b42ff..74c2c7aa69 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -81,6 +81,10 @@ BOOL LLInventoryModel::sTimelyFetchPending = FALSE; LLFrameTimer LLInventoryModel::sFetchTimer; S16 LLInventoryModel::sBulkFetchCount = 0; +// Increment this if the inventory contents change in a non-backwards-compatible way. +// For viewer 2, the addition of link items makes a pre-viewer-2 cache incorrect. +const S32 LLInventoryModel::sCurrentInvCacheVersion = 2; + // RN: for some reason, using std::queue in the header file confuses the compiler which things it's an xmlrpc_queue static std::deque sFetchQueue; @@ -2101,7 +2105,8 @@ bool LLInventoryModel::loadSkeleton( llinfos << "Unable to gunzip " << gzip_filename << llendl; } } - if(loadFromFile(inventory_filename, categories, items)) + bool is_cache_obsolete = false; + if(loadFromFile(inventory_filename, categories, items, is_cache_obsolete)) { // We were able to find a cache of files. So, use what we // found to generate a set of categories we should add. We @@ -2236,6 +2241,12 @@ bool LLInventoryModel::loadSkeleton( // clean up the gunzipped file. LLFile::remove(inventory_filename); } + if(is_cache_obsolete) + { + // If out of date, remove the gzipped file too. + llwarns << "Inv cache out of date, removing" << llendl; + LLFile::remove(gzip_filename); + } categories.clear(); // will unref and delete entries } @@ -2634,7 +2645,8 @@ bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const // static bool LLInventoryModel::loadFromFile(const std::string& filename, LLInventoryModel::cat_array_t& categories, - LLInventoryModel::item_array_t& items) + LLInventoryModel::item_array_t& items, + bool &is_cache_obsolete) { if(filename.empty()) { @@ -2651,11 +2663,32 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, // *NOTE: This buffer size is hard coded into scanf() below. char buffer[MAX_STRING]; /*Flawfinder: ignore*/ char keyword[MAX_STRING]; /*Flawfinder: ignore*/ + char value[MAX_STRING]; /*Flawfinder: ignore*/ + is_cache_obsolete = true; // Obsolete until proven current while(!feof(file) && fgets(buffer, MAX_STRING, file)) { - sscanf(buffer, " %254s", keyword); /* Flawfinder: ignore */ - if(0 == strcmp("inv_category", keyword)) + sscanf(buffer, " %126s %126s", keyword, value); /* Flawfinder: ignore */ + if(0 == strcmp("inv_cache_version", keyword)) { + S32 version; + int succ = sscanf(value,"%d",&version); + if ((1 == succ) && (version == sCurrentInvCacheVersion)) + { + // Cache is up to date + is_cache_obsolete = false; + continue; + } + else + { + // Cache is out of date + break; + } + } + else if(0 == strcmp("inv_category", keyword)) + { + if (is_cache_obsolete) + break; + LLPointer inv_cat = new LLViewerInventoryCategory(LLUUID::null); if(inv_cat->importFileLocal(file)) { @@ -2669,6 +2702,9 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, } else if(0 == strcmp("inv_item", keyword)) { + if (is_cache_obsolete) + break; + LLPointer inv_item = new LLViewerInventoryItem; if( inv_item->importFileLocal(file) ) { @@ -2700,6 +2736,8 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, } } fclose(file); + if (is_cache_obsolete) + return false; return true; } @@ -2721,6 +2759,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename, return false; } + fprintf(file, "\tinv_cache_version\t%d\n",sCurrentInvCacheVersion); S32 count = categories.count(); S32 i; for(i = 0; i < count; ++i) -- cgit v1.2.3