diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2020-12-17 20:33:19 +0000 | 
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2020-12-17 20:33:19 +0000 | 
| commit | 9156c22f73b6706a3f480d0fd72ed04a7de8187b (patch) | |
| tree | 87ae851291f241ac890bf472e50d26ef79e87b83 | |
| parent | da982a227ab69cb91e2c87efcabc0ce11a0c2fa5 (diff) | |
SL-14570 - error reporting and prevention
| -rw-r--r-- | indra/newview/llattachmentsmgr.cpp | 112 | ||||
| -rw-r--r-- | indra/newview/llinventorymodel.cpp | 33 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 13 | 
3 files changed, 88 insertions, 70 deletions
diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index d3e66289d1..443c5ae02f 100644 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -99,22 +99,22 @@ void LLAttachmentsMgr::onIdle()  		return;  	} -    if (LLApp::isExiting()) -    { -        return; -    } +	if (LLApp::isExiting()) +	{ +		return; +	}  	requestPendingAttachments(); -    linkRecentlyArrivedAttachments(); +	linkRecentlyArrivedAttachments(); -    expireOldAttachmentRequests(); +	expireOldAttachmentRequests(); -    expireOldDetachRequests(); +	expireOldDetachRequests(); -    checkInvalidCOFLinks(); -     -    spamStatusInfo(); +	checkInvalidCOFLinks(); +	 +	spamStatusInfo();  }  void LLAttachmentsMgr::requestPendingAttachments() @@ -452,51 +452,55 @@ bool LLAttachmentsMgr::isAttachmentStateComplete() const  //  void LLAttachmentsMgr::checkInvalidCOFLinks()  { -        LLInventoryModel::cat_array_t cat_array; -        LLInventoryModel::item_array_t item_array; -        gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(), -                                      cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); -        for (S32 i=0; i<item_array.size(); i++) -        { -            const LLViewerInventoryItem* inv_item = item_array.at(i).get(); -            const LLUUID& item_id = inv_item->getLinkedUUID(); -            if (inv_item->getType() == LLAssetType::AT_OBJECT) -            { -                LLTimer timer; -                bool is_flagged_questionable = mQuestionableCOFLinks.getTime(item_id,timer); -                bool is_wearing_attachment = isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item_id); -                if (is_wearing_attachment && is_flagged_questionable) -                { -                    LL_DEBUGS("Avatar") << "ATT was flagged questionable but is now "  -                                        << (is_wearing_attachment ? "attached " : "")  -                                        <<"removing flag after " -                                        << timer.getElapsedTimeF32() << " item " -                                        << inv_item->getName() << " id " << item_id << LL_ENDL; -                    mQuestionableCOFLinks.removeTime(item_id); -                } -            } -        } +	if (!gInventory.isInventoryUsable()) +	{ +		return; +	} +	LLInventoryModel::cat_array_t cat_array; +	LLInventoryModel::item_array_t item_array; +	gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(), +								  cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); +	for (S32 i=0; i<item_array.size(); i++) +	{ +		const LLViewerInventoryItem* inv_item = item_array.at(i).get(); +		const LLUUID& item_id = inv_item->getLinkedUUID(); +		if (inv_item->getType() == LLAssetType::AT_OBJECT) +		{ +			LLTimer timer; +			bool is_flagged_questionable = mQuestionableCOFLinks.getTime(item_id,timer); +			bool is_wearing_attachment = isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item_id); +			if (is_wearing_attachment && is_flagged_questionable) +			{ +				LL_DEBUGS("Avatar") << "ATT was flagged questionable but is now "  +									<< (is_wearing_attachment ? "attached " : "")  +									<<"removing flag after " +									<< timer.getElapsedTimeF32() << " item " +									<< inv_item->getName() << " id " << item_id << LL_ENDL; +				mQuestionableCOFLinks.removeTime(item_id); +			} +		} +	} -        for(LLItemRequestTimes::iterator it = mQuestionableCOFLinks.begin(); -            it != mQuestionableCOFLinks.end(); ) -        { -            LLItemRequestTimes::iterator curr_it = it; -            ++it; -            const LLUUID& item_id = curr_it->first; -            LLViewerInventoryItem *inv_item = gInventory.getItem(item_id); -            if (curr_it->second.getElapsedTimeF32() > MAX_BAD_COF_TIME) -            { -                if (LLAppearanceMgr::instance().isLinkedInCOF(item_id)) -                { -                    LL_DEBUGS("Avatar") << "ATT Linked in COF but not attached or requested, deleting link after " -                                        << curr_it->second.getElapsedTimeF32() << " seconds for "  -                                        << (inv_item ? inv_item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; -                    LLAppearanceMgr::instance().removeCOFItemLinks(item_id); -                } -				mQuestionableCOFLinks.erase(curr_it); -                continue; -            } -        } +	for(LLItemRequestTimes::iterator it = mQuestionableCOFLinks.begin(); +		it != mQuestionableCOFLinks.end(); ) +	{ +		LLItemRequestTimes::iterator curr_it = it; +		++it; +		const LLUUID& item_id = curr_it->first; +		LLViewerInventoryItem *inv_item = gInventory.getItem(item_id); +		if (curr_it->second.getElapsedTimeF32() > MAX_BAD_COF_TIME) +		{ +			if (LLAppearanceMgr::instance().isLinkedInCOF(item_id)) +			{ +				LL_DEBUGS("Avatar") << "ATT Linked in COF but not attached or requested, deleting link after " +									<< curr_it->second.getElapsedTimeF32() << " seconds for "  +									<< (inv_item ? inv_item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; +				LLAppearanceMgr::instance().removeCOFItemLinks(item_id); +			} +			mQuestionableCOFLinks.erase(curr_it); +			continue; +		} +	}  }  void LLAttachmentsMgr::spamStatusInfo() diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index e5ff96095a..741c3317f5 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -523,12 +523,18 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot(  		}  	} -	if(rv.isNull() && isInventoryUsable() && create_folder) +	if(rv.isNull() && create_folder && root_id.notNull())  	{ -		if(root_id.notNull()) + +		if (isInventoryUsable())  		{  			return createNewCategory(root_id, preferred_type, LLStringUtil::null);  		} +		else +		{ +			LL_WARNS("Inventory") << "Can't create requested folder, type " << preferred_type +								  << " because inventory is not usable" << LL_ENDL; +		}  	}  	return rv;  } @@ -593,9 +599,10 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,  										   inventory_func_type callback)  {  	LLUUID id; -	if(!isInventoryUsable()) +	if (!isInventoryUsable())  	{ -		LL_WARNS(LOG_INV) << "Inventory is broken." << LL_ENDL; +		LL_WARNS(LOG_INV) << "Inventory is not usable; can't create requested category of type " +						  << preferred_type << LL_ENDL;  		// FIXME failing but still returning an id?  		return id;  	} @@ -2607,10 +2614,20 @@ void LLInventoryModel::buildParentChildMap()  				}  			} -			// 'My Inventory', -			// root of the agent's inv found. -			// The inv tree is built. -			mIsAgentInvUsable = true; +			LLPointer<LLInventoryValidationInfo> validation_info = validate(); +			if (validation_info->mFatalErrorCount > 0) +			{ +				// Fatal inventory error. Will not be able to engage in many inventory operations. +				// This should be followed by an error dialog leading to logout. +				LL_WARNS("Inventory") << "Fatal errors were found in validate(): unable to initialize inventory! " +									  << "Will not be able to do normal inventory operations in this session." +									  << LL_ENDL; +				mIsAgentInvUsable = false; +			} +			else +			{ +				mIsAgentInvUsable = true; +			}  			// notifyObservers() has been moved to  			// llstartup/idle_startup() after this func completes. diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 603f790815..51a96b2b10 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1808,11 +1808,11 @@ bool idle_startup()  		// gInventory.mIsAgentInvUsable is set to true in the gInventory.buildParentChildMap.  		gInventory.buildParentChildMap(); -		// If inventory is unusable, need to flag this and -		// bail out. In particular, must not trigger creation of new system -		// categories. -		LLPointer<LLInventoryValidationInfo> validation_info = gInventory.validate(); -		// FIXME add handling of unfixable corruption here - need to exit and get support to fix. +		// If buildParentChildMap succeeded, inventory will now be in +		// a usable state and gInventory.isInventoryUsable() will be +		// true. + +		// FIXME if inventory is unusable, we need to bail out.  		gInventory.createCommonSystemCategories(); @@ -1858,9 +1858,6 @@ bool idle_startup()  		LLStartUp::setStartupState( STATE_MISC );  		display_startup(); -		// Update status check after various system folders created. -		validation_info = gInventory.validate(); -  		return FALSE;  	}  | 
