Anonymous avatar Anonymous committed 546e254

storm-64: One more toast on failure to verify initial image, and changed a bool to enum

Comments (0)

Files changed (3)

indra/newview/lllocalbitmaps.cpp

 	}
 
 	/* next phase of unit creation is nearly the same as an update cycle.
-	   true means the unit's update is running for the first time so it will not check 
-	   for current usage nor will it attempt to replace the old, non existent image */
-	mValid = updateSelf(true);
+	   we're running updateSelf as a special case with the optional UT_FIRSTUSE
+	   which omits the parts associated with removing the outdated texture */
+	mValid = updateSelf(UT_FIRSTUSE);
 }
 
 LLLocalBitmap::~LLLocalBitmap()
 {
 	// replace IDs with defaults, if set to do so.
-	if(LL_LOCAL_REPLACE_ON_DEL)
+	if(LL_LOCAL_REPLACE_ON_DEL && mValid) // fix for STORM-1837
 	{
 		replaceIDs(mWorldID, IMG_DEFAULT);
 		LLLocalBitmapMgr::doRebake();
 }
 
 /* update functions */
-bool LLLocalBitmap::updateSelf(bool first_update)
+bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate)
 {
 	bool updated = false;
 	
 				{
 					// decode is successful, we can safely proceed.
 					LLUUID old_id = LLUUID::null;
-					if (!first_update && !mWorldID.isNull())
+					if (!(optional_firstupdate == UT_FIRSTUSE) && !mWorldID.isNull())
 					{
 						old_id = mWorldID;
 					}
 
 					gTextureList.addImage(texture);
 			
-					if (!first_update)
+					if (!optional_firstupdate == UT_FIRSTUSE)
 					{
 						// seek out everything old_id uses and replace it with mWorldID
 						replaceIDs(old_id, mWorldID);
 			}
 			else
 			{
+				llwarns << "Attempted to add invalid or unreadable image file, attempt cancelled.\n"
+					    << "Filename: " << filename << llendl;
+
+				LLSD notif_args;
+				notif_args["FNAME"] = filename;
+				LLNotificationsUtil::add("LocalBitmapsVerifyFail", notif_args);
+
 				delete unit;
 				unit = NULL;
 			}

indra/newview/lllocalbitmaps.h

 	public: /* main */
 		LLLocalBitmap(std::string filename);
 		~LLLocalBitmap();
-		bool updateSelf(bool first_update = false);
 
 	public: /* accessors */
 		std::string	getFilename();
 		LLUUID		getWorldID();
 		bool		getValid();
 
-	private: /* maintenance */
+	public: /* self update public section */
+		enum EUpdateType
+		{
+			UT_FIRSTUSE,
+			UT_REGUPDATE
+		};
+
+		bool updateSelf(EUpdateType = UT_REGUPDATE);
+
+	private: /* self update private section */
 		bool decodeBitmap(LLPointer<LLImageRaw> raw);
 		void replaceIDs(LLUUID old_id, LLUUID new_id);
-
-	private: /* id replacement */
 		std::vector<LLViewerObject*> prepUpdateObjects(LLUUID old_id);
 		void updateUserPrims(LLUUID old_id, LLUUID new_id);
 		void updateUserSculpts(LLUUID old_id, LLUUID new_id);
 		void updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type);
 		LLVOAvatarDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLVOAvatarDefines::EBakedTextureIndex baked_texind);
 
-	private: /* enums */
+	private: /* private enums */
 		enum ELinkStatus
 		{
 			LS_ON,

indra/newview/skins/default/xui/en/notifications.xml

 [FNAME] could not be opened or decoded for [NRETRIES] attempts, and is now considered broken.
 Disabling future updates for this file.
   </notification>
+
+  <notification
+   icon="alertmodal.tga"
+   name="LocalBitmapsVerifyFail"
+   persist="true"
+   type="notify">
+Attempted to add an invalid or unreadable image file [FNAME] which could not be opened or decoded.
+Attempt cancelled.
+  </notification>
   
 </notifications>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.