diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 065f07ff13f6bb7faf5039b4e9c405a39eda558d..e06dea8f14c72a02fa13905ae8860ed44c02b444 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1839,13 +1839,13 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo
 
 // [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0)
 	// RELEASE-RLVa: [SL-3.4] Check our callers and verify that erasing elements from the passed vector won't break random things
-	if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
+	if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
 	{
 		llvo_vec_t::iterator itObj = objects_to_remove.begin();
 		while (objects_to_remove.end() != itObj)
 		{
 			const LLViewerObject* pAttachObj = *itObj;
-			if (gRlvAttachmentLocks.isLockedAttachment(pAttachObj))
+			if (RlvAttachmentLocks::instance().isLockedAttachment(pAttachObj))
 			{
 				itObj = objects_to_remove.erase(itObj);
 
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 0644fdb2511af03a3eb86b495d9553abf132db2c..b0b216c3be474b8f7215acfd76d9f0b40f38386b 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -2150,7 +2150,7 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
 //	getDescendentsOfAssetType(category, body_items, LLAssetType::AT_BODYPART);
 // [RLVa:KB] - Checked: RLVa-2.0.3
 	// Filter out any new body parts that can't be worn before adding them
-	if ( (RlvActions::isRlvEnabled()) && ((gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ADD))) )
+	if ( (RlvActions::isRlvEnabled()) && ((RlvWearableLocks::instance().hasLockedWearableType(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ADD))) )
 		body_items_new.erase(std::remove_if(body_items_new.begin(), body_items_new.end(), RlvPredCanNotWearItem(RLV_WEAR_REPLACE)), body_items_new.end());
 	body_items.insert(body_items.end(), body_items_new.begin(), body_items_new.end());
 // [/RLVa:KB]
@@ -2168,7 +2168,7 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
 	if (append)
 		getDescendentsOfAssetType(cof, wear_items, LLAssetType::AT_CLOTHING);
 // [RLVa:KB] - Checked: RLVa-2.0.3
-	else if ( (RlvActions::isRlvEnabled()) && ((gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_REMOVE))) )
+	else if ( (RlvActions::isRlvEnabled()) && ((RlvWearableLocks::instance().hasLockedWearableType(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_REMOVE))) )
 	{
 		// Make sure that all currently locked clothing layers remain in COF when replacing
 		getDescendentsOfAssetType(cof, wear_items, LLAssetType::AT_CLOTHING);
@@ -2178,7 +2178,7 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
 //	getDescendentsOfAssetType(category, wear_items, LLAssetType::AT_CLOTHING);
 // [RLVa:KB] - Checked: RLVa-2.0.3
 	// Filter out any new wearables that can't be worn before adding them
-	if ( (RlvActions::isRlvEnabled()) && ((gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ADD))) )
+	if ( (RlvActions::isRlvEnabled()) && ((RlvWearableLocks::instance().hasLockedWearableType(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ADD))) )
 		wear_items_new.erase(std::remove_if(wear_items_new.begin(), wear_items_new.end(), RlvPredCanNotWearItem(RLV_WEAR)), wear_items_new.end());
 	wear_items.insert(wear_items.end(), wear_items_new.begin(), wear_items_new.end());
 // [/RLVa:KB]
@@ -2196,7 +2196,7 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
 	if (append)
 		getDescendentsOfAssetType(cof, obj_items, LLAssetType::AT_OBJECT);
 // [RLVa:KB] - Checked: RLVa-2.0.3
-	else if ( (RlvActions::isRlvEnabled()) && ((gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_REMOVE))) )
+	else if ( (RlvActions::isRlvEnabled()) && ((RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_REMOVE))) )
 	{
 		// Make sure that all currently locked attachments remain in COF when replacing
 		getDescendentsOfAssetType(cof, obj_items, LLAssetType::AT_OBJECT);
@@ -2206,7 +2206,7 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
 //	getDescendentsOfAssetType(category, obj_items, LLAssetType::AT_OBJECT);
 // [RLVa:KB] - Checked: RLVa-2.0.3
 	// Filter out any new attachments that can't be worn before adding them
-	if ( (RlvActions::isRlvEnabled()) && ((gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ADD))) )
+	if ( (RlvActions::isRlvEnabled()) && ((RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ADD))) )
 		obj_items_new.erase(std::remove_if(obj_items_new.begin(), obj_items_new.end(), RlvPredCanNotWearItem(RLV_WEAR)), obj_items_new.end());
 	obj_items.insert(obj_items.end(), obj_items_new.begin(), obj_items_new.end());
 // [/RLVa:KB]
@@ -2358,10 +2358,10 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder)
 					//     => if it's changed to debug-only then we make tge assumption that anything that makes it into COF is always OK
 #ifdef RLV_DEBUG
 					// NOTE: make sure we don't accidentally block setting the initial wearables
-					if ( (rlv_handler_t::isEnabled()) && (RLV_WEAR_LOCKED == gRlvWearableLocks.canWear(wearable->getType())) &&
+					if ( (rlv_handler_t::isEnabled()) && (RLV_WEAR_LOCKED == RlvWearableLocks::instance().canWear(wearable->getType())) &&
 						 (!gAgentWearables.getWearableFromItemID(item->getUUID())) && (gAgentWearables.areWearablesLoaded()) )
 					{
-						RLV_VERIFY(RLV_WEAR_LOCKED == gRlvWearableLocks.canWear(wearable->getType()));
+						RLV_VERIFY(RLV_WEAR_LOCKED == RlvWearableLocks::instance().canWear(wearable->getType()));
 						continue;
 					}
 #endif // RLV_DEBUG
@@ -2711,7 +2711,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
 #ifdef LL_RELEASE_FOR_DOWNLOAD
 			// Don't allow forcing an invalid wearable if the initial wearables aren't set yet, or if any wearable type is currently locked
 			if ( (!rlv_handler_t::isEnabled()) || 
-				 ((gAgentWearables.areInitalWearablesLoaded()) && (!gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_REMOVE))) )
+				 ((gAgentWearables.areInitalWearablesLoaded()) && (!RlvWearableLocks::instance().hasLockedWearableType(RLV_LOCK_REMOVE))) )
 #endif // LL_RELEASE_FOR_DOWNLOAD
 			{
 				if (missing_type != LLWearableType::WT_INVALID && missing_type == found.mWearableType)
diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp
index 2862b8b2260e93c588bfb53b2eaa4c62e30131ee..b4b30d9d49943fcd2eac587c86c200b974e82a86 100644
--- a/indra/newview/llattachmentsmgr.cpp
+++ b/indra/newview/llattachmentsmgr.cpp
@@ -104,14 +104,14 @@ void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id,
 	attachment.mAdd = add;
 
 // [RLVa:KB] - Checked: 2010-09-23 (RLVa-1.2.1)
-	if ( (RlvActions::isRlvEnabled()) && (!fRlvForce) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) && (gAgentWearables.areInitialAttachmentsRequested()) )
+	if ( (RlvActions::isRlvEnabled()) && (!fRlvForce) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY)) && (gAgentWearables.areInitialAttachmentsRequested()) )
 	{
 		const LLInventoryItem* pItem = gInventory.getItem(item_id); 
 		if (!pItem)
 			return;
 
 		LLViewerJointAttachment* pAttachPt = NULL;
-		ERlvWearMask eWearMask = gRlvAttachmentLocks.canAttach(pItem, &pAttachPt);
+		ERlvWearMask eWearMask = RlvAttachmentLocks::instance().canAttach(pItem, &pAttachPt);
 		if ( ((add) && ((RLV_WEAR_ADD & eWearMask) == 0)) || ((!add) && ((RLV_WEAR_REPLACE & eWearMask) == 0)) )
 			return;
 
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 168399956822d4d76ee1b066fe6d90d0a47b53f4..07ecd5e7ad66af1e67a4d3a5c4227d6443fe075e 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -6538,7 +6538,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 	// If no attachment point was specified, try looking it up from the item name
 	static LLCachedControl<bool> fRlvDeprecateAttachPt(gSavedSettings, "RLVaDebugDeprecateExplicitPoint", false);
 	if ( (rlv_handler_t::isEnabled()) && (!fRlvDeprecateAttachPt) && 
-	     (!attachment) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
+	     (!attachment) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
 	{
 		attachment = RlvAttachPtLookup::getAttachPoint(item);
 	}
@@ -6582,7 +6582,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 	{
 // [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1)
 		// Block if we can't "replace wear" what's currently there
-		if ( (rlv_handler_t::isEnabled()) && ((gRlvAttachmentLocks.canAttach(attachment) & RLV_WEAR_REPLACE) == 0) )
+		if ( (rlv_handler_t::isEnabled()) && ((RlvAttachmentLocks::instance().canAttach(attachment) & RLV_WEAR_REPLACE) == 0) )
 		{
 			return;
 		}
@@ -6593,7 +6593,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 	{
 // [RLVa:KB] - Checked: 2010-08-07 (RLVa-1.2.0)
 		// Block wearing anything on a non-attachable attachment point
-		if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachmentPoint(attach_pt, RLV_LOCK_ADD)) )
+		if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().isLockedAttachmentPoint(attach_pt, RLV_LOCK_ADD)) )
 		{
 			return;
 		}
@@ -6673,7 +6673,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 				items.push_back(std::string("Detach From Yourself"));
 				items.push_back(std::string("Edit Object"));
 // [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
-				if ( (rlv_handler_t::isEnabled()) && (!gRlvAttachmentLocks.canDetach(item)) )
+				if ( (rlv_handler_t::isEnabled()) && (!RlvAttachmentLocks::instance().canDetach(item)) )
 					disabled_items.push_back(std::string("Detach From Yourself"));
 // [/RLVa:KB]
 			}
@@ -6697,7 +6697,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 // [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a
 				else if (rlv_handler_t::isEnabled())
 				{
-					ERlvWearMask eWearMask = gRlvAttachmentLocks.canAttach(item);
+					ERlvWearMask eWearMask = RlvAttachmentLocks::instance().canAttach(item);
 					if ((eWearMask & RLV_WEAR_REPLACE) == 0)
 						disabled_items.push_back(std::string("Wearable And Object Wear"));
 					if ((eWearMask & RLV_WEAR_ADD) == 0)
@@ -6949,7 +6949,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 						disabled_items.push_back(std::string("Wearable And Object Wear"));
 						disabled_items.push_back(std::string("Wearable Add"));
 // [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0c) | Added: RLVa-1.2.0c
-						if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item)) )
+						if ( (rlv_handler_t::isEnabled()) && (!RlvWearableLocks::instance().canRemove(item)) )
 							disabled_items.push_back(std::string("Take Off"));
 // [/RLVa:KB]
 					}
@@ -6962,7 +6962,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 // [RLVa:KB] - Checked: 2010-06-09 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g
 						if (rlv_handler_t::isEnabled())
 						{
-							ERlvWearMask eWearMask = gRlvWearableLocks.canWear(item);
+							ERlvWearMask eWearMask = RlvWearableLocks::instance().canWear(item);
 							if ((eWearMask & RLV_WEAR_REPLACE) == 0)
 								disabled_items.push_back(std::string("Wearable And Object Wear"));
 							if ((eWearMask & RLV_WEAR_ADD) == 0)
diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp
index f800d683aa918f9b70f911f6407257534008f50a..74c12e20d620f0216163716c849466187792cb21 100644
--- a/indra/newview/llpanelcontents.cpp
+++ b/indra/newview/llpanelcontents.cpp
@@ -121,7 +121,7 @@ void LLPanelContents::getState(LLViewerObject *objectp )
 	{
 		// Don't allow creation of new scripts if it's non-detachable
 		if (objectp->isAttachment())
-			editable = !gRlvAttachmentLocks.isLockedAttachment(objectp->getRootEdit());
+			editable = !RlvAttachmentLocks::instance().isLockedAttachment(objectp->getRootEdit());
 
 		// Don't allow creation of new scripts if we're @unsit=n or @sittp=n restricted and we're sitting on the selection
 		if ( (editable) && ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) )
@@ -181,7 +181,7 @@ void LLPanelContents::onClickNewScript(void *userdata)
 // [RLVa:KB] - Checked: 2010-03-31 (RLVa-1.2.0c) | Modified: RLVa-1.0.5a
 		if (rlv_handler_t::isEnabled())	// Fallback code [see LLPanelContents::getState()]
 		{
-			if (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit()))
+			if (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit()))
 			{
 				return;					// Disallow creating new scripts in a locked attachment
 			}
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 93ee2a0577459eb1c2d0bcfe5640b6a6a13cb92b..6d35242164d6a88ddaf5ee564a346dad922ba4a0 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -295,7 +295,7 @@ BOOL LLTaskInvFVBridge::isItemRenameable() const
 {
 // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.5a
 	LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
-	if ( (rlv_handler_t::isEnabled()) && (object) && (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) )
+	if ( (rlv_handler_t::isEnabled()) && (object) && (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit())) )
 	{
 		return FALSE;
 	}
@@ -319,7 +319,7 @@ BOOL LLTaskInvFVBridge::renameItem(const std::string& new_name)
 {
 // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.5a
 	LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
-	if ( (rlv_handler_t::isEnabled()) && (object) && (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) )
+	if ( (rlv_handler_t::isEnabled()) && (object) && (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit())) )
 	{
 		return FALSE;
 	}
@@ -358,7 +358,7 @@ BOOL LLTaskInvFVBridge::isItemMovable() const
 		const LLViewerObject* pObj = gObjectList.findObject(mPanel->getTaskUUID());
 		if (pObj)
 		{
-			if (gRlvAttachmentLocks.isLockedAttachment(pObj->getRootEdit()))
+			if (RlvAttachmentLocks::instance().isLockedAttachment(pObj->getRootEdit()))
 			{
 				return FALSE;
 			}
@@ -379,7 +379,7 @@ BOOL LLTaskInvFVBridge::isItemRemovable() const
 // [RLVa:KB] - Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-1.0.5a
 	if ( (object) && (rlv_handler_t::isEnabled()) )
 	{
-		if (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit()))
+		if (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit()))
 		{
 			return FALSE;
 		}
@@ -541,7 +541,7 @@ BOOL LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
 														GP_OBJECT_MANIPULATE);
 // [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.2.1f) | Modified: RLVa-1.0.5a
 				// Kind of redundant due to the note below, but in case that ever gets fixed
-				if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) )
+				if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit())) )
 				{
 					return FALSE;
 				}
@@ -611,7 +611,7 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		if (rlv_handler_t::isEnabled())
 		{
 			LLViewerObject* pAttachObj = gObjectList.findObject(mPanel->getTaskUUID());
-			bool fLocked = (pAttachObj) ? gRlvAttachmentLocks.isLockedAttachment(pAttachObj->getRootEdit()) : false;
+			bool fLocked = (pAttachObj) ? RlvAttachmentLocks::instance().isLockedAttachment(pAttachObj->getRootEdit()) : false;
 			if ( ((LLAssetType::AT_NOTECARD == item->getType()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_VIEWNOTE)) || (fLocked))) || 
 				 ((LLAssetType::AT_LSL_TEXT == item->getType()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_VIEWSCRIPT)) || (fLocked))) ||
 				 ((LLAssetType::AT_TEXTURE == item->getType()) && (!RlvActions::canPreviewTextures())))
@@ -1028,7 +1028,7 @@ void LLTaskLSLBridge::openItem()
 		return;
 	}
 // [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.0b) | Modified: RLVa-1.1.0a
-	if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) )
+	if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit())) )
 	{
 		RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_SCRIPT);
 		return;
@@ -1097,7 +1097,7 @@ void LLTaskNotecardBridge::openItem()
 	}
 
 // [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.0b) | Modified: RLVa-1.2.0b
-	if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) )
+	if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit())) )
 	{
 		RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_NOTECARD);
 		return;
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index b441fb09eebc4860f4df6a722304515681b53482..7bdad0ecb6c688c57b78fe552406e9937e198be6 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -2111,7 +2111,7 @@ void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata )
 	if( object )
 	{
 // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.5a
-		if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) )
+		if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit())) )
 		{
 			RlvUtil::notifyBlockedGeneric();
 			return;
@@ -2144,7 +2144,7 @@ void LLLiveLSLEditor::onReset(void *userdata)
 	if(object)
 	{
 // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.5a
-		if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) )
+		if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit())) )
 		{
 			RlvUtil::notifyBlockedGeneric();
 			return;
@@ -2281,7 +2281,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/)
 	}
 
 // [RLVa:KB] - Checked: 2010-11-25 (RLVa-1.2.2b) | Modified: RLVa-1.2.2b
-	if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) )
+	if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().isLockedAttachment(object->getRootEdit())) )
 	{
 		RlvUtil::notifyBlockedGeneric();
 		return;
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 9ed1b6889ba65a7d7ca8303ec0f0ba1145d71fca..006bee871b52d0b1972d2298b80040ae735a3c0d 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1611,7 +1611,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 	if (rlv_handler_t::isEnabled())
 	{
 		const LLViewerObject* pObjRoot = obj->getRootEdit();
-		if (gRlvAttachmentLocks.isLockedAttachment(pObjRoot))
+		if (RlvAttachmentLocks::instance().isLockedAttachment(pObjRoot))
 		{
 			return ACCEPT_NO_LOCKED;		// Disallow inventory drops on a locked attachment
 		}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 765af4c0514ab0b1551121903fa3b4802851b6f2..183e1e22e7363c6e4d8e4e936d08ee29b82513b8 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1101,7 +1101,7 @@ void render_hud_attachments()
 	// clamp target zoom level to reasonable values
 //	gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f);
 // [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) | Modified: RLVa-1.0.0c
-	gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, (!gRlvAttachmentLocks.hasLockedHUD()) ? 0.1f : 0.85f, 1.f);
+	gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, (!RlvAttachmentLocks::instance().hasLockedHUD()) ? 0.1f : 0.85f, 1.f);
 // [/RLVa:KB]
 
 	// smoothly interpolate current zoom level
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 2dd31c50593e567ac9e468829b907c1180f28ff8..15ee9749dbff2f1f4639f810b01a4bab7199dd93 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -1226,7 +1226,7 @@ class LLAdvancedToggleWireframe : public view_listener_t
 	bool handleEvent(const LLSD& userdata) override
 	{
 // [RLVa:KB] - Checked: RLVa-2.0.0
-		bool fRlvBlockWireframe = gRlvAttachmentLocks.hasLockedHUD();
+		bool fRlvBlockWireframe = RlvAttachmentLocks::instance().hasLockedHUD();
 		if ( (!gUseWireframe) && (fRlvBlockWireframe) )
 			RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_WIREFRAME);
 		set_use_wireframe( (!gUseWireframe) && (!fRlvBlockWireframe) );
@@ -3022,7 +3022,7 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t
 				LLViewerJointAttachment* attachment = curiter->second;
 //				if (attachment->getNumObjects() > 0)
 // [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Added: RLVa-1.2.0a
-				if ( (attachment->getNumObjects() > 0) && ((!rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(attachment))) )
+				if ( (attachment->getNumObjects() > 0) && ((!rlv_handler_t::isEnabled()) || (RlvAttachmentLocks::instance().canDetach(attachment))) )
 // [/RLVa:KB]
 				{
 					new_value = true;
@@ -5405,7 +5405,7 @@ class LLToolsReleaseKeys : public view_listener_t
 	bool handleEvent(const LLSD& userdata) override
 	{
 // [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) | Modified: RLVa-1.0.5a
-		if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
+		if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
 			return true;
 // [/RLVa:KB]
 
@@ -5420,7 +5420,7 @@ class LLToolsEnableReleaseKeys : public view_listener_t
 	{
 // [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) | Modified: RLVa-1.0.5a
 		return (gAgent.anyControlGrabbed()) && 
-			( (!rlv_handler_t::isEnabled()) || (!gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) );
+			( (!rlv_handler_t::isEnabled()) || (!RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) );
 // [/RLVa:KB]
 //		return gAgent.anyControlGrabbed();
 	}
@@ -6749,8 +6749,8 @@ private:
 // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f
 			// RELEASE-RLVa: [SL-2.2.0] If 'index != 0' then the object will be "add attached" [see LLSelectMgr::sendAttach()]
 			if ( (rlv_handler_t::isEnabled()) &&
-				 ( ((!index) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY))) ||		    // Can't wear on default
-				   ((index) && ((RLV_WEAR_ADD & gRlvAttachmentLocks.canAttach(attachment_point)) == 0)) ||	// or non-attachable attachpt
+				 ( ((!index) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY))) ||		    // Can't wear on default
+				   ((index) && ((RLV_WEAR_ADD & RlvAttachmentLocks::instance().canAttach(attachment_point)) == 0)) ||	// or non-attachable attachpt
 				   (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) ) )											    // Attach on object == "Take"
 			{
 				setObjectSelection(NULL); // Clear the selection or it'll get stuck
@@ -6905,7 +6905,7 @@ class LLAttachmentDrop : public view_listener_t
 // [RLVa:KB] - Checked: 2010-03-15 (RLVa-1.2.0e) | Modified: RLVa-1.0.5
 		if (rlv_handler_t::isEnabled())
 		{
-			if (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE))
+			if (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_REMOVE))
 			{
 				// NOTE: copy/paste of the code in enable_detach()
 				LLObjectSelectionHandle hSelect = LLSelectMgr::getInstance()->getSelection();
@@ -6947,13 +6947,13 @@ class LLAttachmentDetachFromPoint : public view_listener_t
 		const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
 //		if (attachment && attachment->getNumObjects() > 0)
 // [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Added: RLVa-1.2.0a
-		if (attachment && (attachment->getNumObjects() > 0) && ((!rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(attachment))) )
+		if (attachment && (attachment->getNumObjects() > 0) && ((!rlv_handler_t::isEnabled()) || (RlvAttachmentLocks::instance().canDetach(attachment))) )
 // [/RLVa:KB]
 		{
 			for (const auto& attached_object : attachment->mAttachedObjects)
             {
 // [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Added: RLVa-1.2.0a
-				if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachment(attached_object)) )
+				if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().isLockedAttachment(attached_object)) )
 					continue;
                 ids_to_remove.push_back(attached_object->getAttachmentItemID());
 // [/RLVa:KB]
@@ -6997,7 +6997,7 @@ static bool onEnableAttachmentLabel(LLUICtrl* ctrl, const LLSD& data)
 
 // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f
 		if (rlv_handler_t::isEnabled())
-			fRlvEnable = (!gRlvAttachmentLocks.isLockedAttachmentPoint(attachment, RLV_LOCK_ADD));
+			fRlvEnable = (!RlvAttachmentLocks::instance().isLockedAttachmentPoint(attachment, RLV_LOCK_ADD));
 // [/RLVa:KB]
 
 		menu->setLabel(label);
@@ -7047,7 +7047,7 @@ class LLAttachmentDetach : public view_listener_t
 
 // [RLVa:KB] - Checked: 2010-03-15 (RLVa-1.2.0a) | Modified: RLVa-1.0.5
 		// NOTE: copy/paste of the code in enable_detach()
-		if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
+		if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
 		{
 			LLObjectSelectionHandle hSelect = LLSelectMgr::getInstance()->getSelection();
 			RlvSelectHasLockedAttach f;
@@ -7167,7 +7167,7 @@ BOOL enable_detach(const LLSD&)
 
 			// RELEASE-RLVa: [SL-2.2.0] LLSelectMgr::sendDetach() and LLSelectMgr::sendDropAttachment() call sendListToRegions with
 			//                          SEND_ONLY_ROOTS so we only need to examine the roots which saves us time
-			if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
+			if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
 			{
 				LLObjectSelectionHandle hSelect = LLSelectMgr::getInstance()->getSelection();
 				RlvSelectHasLockedAttach f;
@@ -7212,8 +7212,8 @@ BOOL object_selected_and_point_valid(const LLSD& sdParam)
 		// RELEASE-RLVa: [SL-2.2.0] If 'idxAttachPt != 0' then the object will be "add attached" [see LLSelectMgr::sendAttach()]
 		const LLViewerJointAttachment* pAttachPt = 
 			get_if_there(gAgentAvatarp->mAttachmentPoints, sdParam.asInteger(), (LLViewerJointAttachment*)NULL);
-		if ( ((!pAttachPt) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY))) ||		// Can't wear on default attach point
-			 ((pAttachPt) && ((RLV_WEAR_ADD & gRlvAttachmentLocks.canAttach(pAttachPt)) == 0)) ||	// or non-attachable attach point
+		if ( ((!pAttachPt) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY))) ||		// Can't wear on default attach point
+			 ((pAttachPt) && ((RLV_WEAR_ADD & RlvAttachmentLocks::instance().canAttach(pAttachPt)) == 0)) ||	// or non-attachable attach point
 			 (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) )												// Attach on object == "Take"
 		{
 			return FALSE;
@@ -7288,7 +7288,7 @@ class LLAttachmentPointFilled : public view_listener_t
 // [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Added: RLVa-1.2.0a
 			// Enable the option if there is at least one attachment on this attachment point that can be detached
 			enable = (found_it->second->getNumObjects() > 0) && 
-				((!rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(found_it->second)));
+				((!rlv_handler_t::isEnabled()) || (RlvAttachmentLocks::instance().canDetach(found_it->second)));
 // [/RLVa:KB]
 		}
 		return enable;
@@ -7410,7 +7410,7 @@ class LLToolsSelectedScriptAction : public view_listener_t
 	{
 // [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) | Modified: RLVa-1.0.5a
 		// We'll allow resetting the scripts of objects on a non-attachable attach point since they wouldn't be able to circumvent anything
-		if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
+		if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
 		{
 			LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection();
 			RlvSelectHasLockedAttach f;
@@ -7570,7 +7570,7 @@ void handle_test_male(void*)
 // [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a
 	// TODO-RLVa: [RLVa-1.2.1] Is there any reason to still block this?
 	if ( (rlv_handler_t::isEnabled()) && 
-		 ((gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY))) )
+		 ((RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (RlvWearableLocks::instance().hasLockedWearableType(RLV_LOCK_ANY))) )
 	{
 		return;
 	}
@@ -7585,7 +7585,7 @@ void handle_test_female(void*)
 // [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a
 	// TODO-RLVa: [RLVa-1.2.1] Is there any reason to still block this?
 	if ( (rlv_handler_t::isEnabled()) && 
-		 ((gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY))) )
+		 ((RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (RlvWearableLocks::instance().hasLockedWearableType(RLV_LOCK_ANY))) )
 	{
 		return;
 	}
@@ -7758,7 +7758,7 @@ static bool is_editable_selected()
 {
 // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.5a
 	// RELEASE-RLVa: [SL-2.2.0] Check that this still isn't called by anything but script actions in the Build menu
-	if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
+	if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) )
 	{
 		LLObjectSelectionHandle hSelection = LLSelectMgr::getInstance()->getSelection();
 
@@ -8638,7 +8638,7 @@ class LLViewShowHUDAttachments : public view_listener_t
 	bool handleEvent(const LLSD& userdata) override
 	{
 // [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.1a) | Modified: RLVa-1.0.0c
-		if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedHUD()) && (LLPipeline::sShowHUDAttachments) )
+		if ( (rlv_handler_t::isEnabled()) && (RlvAttachmentLocks::instance().hasLockedHUD()) && (LLPipeline::sShowHUDAttachments) )
 			return true;
 // [/RLVa:KB]
 
@@ -8666,7 +8666,7 @@ class LLEditEnableTakeOff : public view_listener_t
 // [RLVa:KB] - Checked: 2010-03-20 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a
 		// NOTE: see below - enable if there is at least one wearable on this type that can be removed
 		if ( (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT) && 
-			 ((!rlv_handler_t::isEnabled()) || (gRlvWearableLocks.canRemove(type))) )
+			 ((!rlv_handler_t::isEnabled()) || (RlvWearableLocks::instance().canRemove(type))) )
 // [/RLVa:KB]
 		{
 			return LLAgentWearables::selfHasWearable(type);
@@ -8693,13 +8693,13 @@ class LLEditTakeOff : public view_listener_t
 				U32 wearable_index = gAgentWearables.getWearableCount(type) - 1;
 
 // [RLVa:KB] - Checked: 2010-06-09 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
-				if ( (rlv_handler_t::isEnabled()) && (gRlvWearableLocks.hasLockedWearable(type)) )
+				if ( (rlv_handler_t::isEnabled()) && (RlvWearableLocks::instance().hasLockedWearable(type)) )
 				{
 					// We'll use the first wearable we come across that can be removed (moving from top to bottom)
 					for (; wearable_index >= 0; wearable_index--)
 					{
 						const LLViewerWearable* pWearable = gAgentWearables.getViewerWearable(type, wearable_index);
-						if (!gRlvWearableLocks.isLockedWearable(pWearable))
+						if (!RlvWearableLocks::instance().isLockedWearable(pWearable))
 							break;
 					}
 					if (wearable_index < 0)
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 48f82da8ea2b70fb1ebda69bc6cc2b304e5c1b01..780e94b4d51af149fd72864662c4d4c3a29c08ab 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2093,7 +2093,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 							{
 								// Rezzed object that's being worn as an attachment (we're assuming this will be due to llAttachToAvatar())
 								S32 idxAttachPt = ATTACHMENT_ID_FROM_STATE(getAttachmentState());
-								if (gRlvAttachmentLocks.isLockedAttachmentPoint(idxAttachPt, RLV_LOCK_ADD))
+								if (RlvAttachmentLocks::instance().isLockedAttachmentPoint(idxAttachPt, RLV_LOCK_ADD))
 								{
 									// If this will end up on an "add locked" attachment point then treat the attach as a user action
 									LLNameValue* nvItem = getNVPair("AttachItemID");
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 90a4b54e088764dbe54d884ca05054ccecd7ad0f..0aec31192248ee8fa927f0d9627ebd509a6c0131 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1374,8 +1374,8 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
 			RlvAttachmentLockWatchdog::instance().onAttach(viewer_object, attachment);
 			gRlvHandler.onAttach(viewer_object, attachment);
 
-			if ( (attachment->getIsHUDAttachment()) && (!gRlvAttachmentLocks.hasLockedHUD()) )
-				gRlvAttachmentLocks.updateLockedHUD();
+			if ( (attachment->getIsHUDAttachment()) && (!RlvAttachmentLocks::instance().hasLockedHUD()) )
+				RlvAttachmentLocks::instance().updateLockedHUD();
 		}
 // [/RLVa:KB]
 	}
@@ -1438,8 +1438,8 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
 		}
 		
 // [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) | Added: RLVa-1.2.1a
-		if ( (rlv_handler_t::isEnabled()) && (viewer_object->isHUDAttachment()) && (gRlvAttachmentLocks.hasLockedHUD()) )
-			gRlvAttachmentLocks.updateLockedHUD();
+		if ( (rlv_handler_t::isEnabled()) && (viewer_object->isHUDAttachment()) && (RlvAttachmentLocks::instance().hasLockedHUD()) )
+			RlvAttachmentLocks::instance().updateLockedHUD();
 // [/RLVa:KB]
 
 		return TRUE;
@@ -1453,7 +1453,7 @@ BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id)
 	LLInventoryItem* item = gInventory.getItem(item_id);
 //	if (item)
 // [RLVa:KB] - Checked: 2010-09-04 (RLVa-1.2.1c) | Added: RLVa-1.2.1c
-	if ( (item) && ((!rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(item))) )
+	if ( (item) && ((!rlv_handler_t::isEnabled()) || (RlvAttachmentLocks::instance().canDetach(item))) )
 // [/RLVa:KB]
 	{
 		gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index efc44346d24269454ceaac63f9affdfcd33e5090..14dd17912bdd87b4ea523e929b59068870f72744 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5083,7 +5083,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
 	bool selected = pObj->isSelected();
 	if ( (pObj->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects) &&
 		 ( (!RlvActions::isRlvEnabled()) ||
-		   ( ((!pObj->isHUDAttachment()) || (!gRlvAttachmentLocks.isLockedAttachment(pObj->getRootEdit()))) &&
+		   ( ((!pObj->isHUDAttachment()) || (!RlvAttachmentLocks::instance().isLockedAttachment(pObj->getRootEdit()))) &&
 		     (RlvActions::canEdit(pObj)) ) ) )
 // [/RVLa:KB]
 	{
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index 01d3a83272898812bb849a91c9c119a72e4e5fef..8d17714bd200ac68685c0e3375ed379cf48e8246 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -897,12 +897,12 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
 			{
 				case LLAssetType::AT_BODYPART:
 				case LLAssetType::AT_CLOTHING:
-					eWearMask = gRlvWearableLocks.canWear(item);
-					rlvCanRemove |= (is_worn) ? gRlvWearableLocks.canRemove(item) : false;
+					eWearMask = RlvWearableLocks::instance().canWear(item);
+					rlvCanRemove |= (is_worn) ? RlvWearableLocks::instance().canRemove(item) : false;
 					break;
 				case LLAssetType::AT_OBJECT:
-					eWearMask = gRlvAttachmentLocks.canAttach(item);
-					rlvCanRemove |= (is_worn) ? gRlvAttachmentLocks.canDetach(item) : false;
+					eWearMask = RlvAttachmentLocks::instance().canAttach(item);
+					rlvCanRemove |= (is_worn) ? RlvAttachmentLocks::instance().canDetach(item) : false;
 					break;
 				default:
 					break;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index e1b86c761b07406f8f8bd5ef8ee4dcc296b3a4a9..06de52f1fefdcbeaa2fc136b8e18475d4213941a 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -3452,7 +3452,7 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)
 		const LLViewerObject* pObj = drawablep->getVObj();
 		if ( (pObj) && (pObj->isSelected()) && 
 			 ( (!RlvActions::isRlvEnabled()) || 
-			   ( ((!pObj->isHUDAttachment()) || (!gRlvAttachmentLocks.isLockedAttachment(pObj->getRootEdit()))) && 
+			   ( ((!pObj->isHUDAttachment()) || (!RlvAttachmentLocks::instance().isLockedAttachment(pObj->getRootEdit()))) && 
 			     (RlvActions::canEdit(pObj)) ) ) )
 // [/RVLa:KB]
 		{
diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp
index e4062f0c1127f92379afafa4dc545a4d83df0bde..891c9680111b6c5fecc1179cdcc11867bf155aa7 100644
--- a/indra/newview/rlvcommon.cpp
+++ b/indra/newview/rlvcommon.cpp
@@ -515,7 +515,7 @@ void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy, bool fCl
 void RlvUtil::filterScriptQuestions(S32& nQuestions, LLSD& sdPayload)
 {
 	// Check SCRIPT_PERMISSION_ATTACH
-	if ((!gRlvAttachmentLocks.canAttach()) && (SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_ATTACH].permbit & nQuestions))
+	if ((!RlvAttachmentLocks::instance().canAttach()) && (SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_ATTACH].permbit & nQuestions))
 	{
 		// Notify the user that we blocked it since they're not allowed to wear any new attachments
 		sdPayload["rlv_blocked"] = RLV_STRING_BLOCKED_PERMATTACH;
@@ -770,7 +770,7 @@ bool rlvCanDeleteOrReturn()
 // Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-0.2.0f
 bool RlvSelectHasLockedAttach::apply(LLSelectNode* pNode)
 {
-	return (pNode->getObject()) ? gRlvAttachmentLocks.isLockedAttachment(pNode->getObject()->getRootEdit()) : false;
+	return (pNode->getObject()) ? RlvAttachmentLocks::instance().isLockedAttachment(pNode->getObject()->getRootEdit()) : false;
 }
 
 // Checked: 2010-11-29 (RLVa-1.3.0c) | Added: RLVa-1.3.0c
@@ -801,11 +801,11 @@ bool rlvPredCanWearItem(const LLViewerInventoryItem* pItem, ERlvWearMask eWearMa
 		{
 			case LLAssetType::AT_BODYPART:
 				// NOTE: only one body part of each type is allowed so the only way to wear one is if we can replace the current one
-				return (RLV_WEAR_LOCKED != (gRlvWearableLocks.canWear(pItem) & RLV_WEAR_REPLACE & eWearMask));
+				return (RLV_WEAR_LOCKED != (RlvWearableLocks::instance().canWear(pItem) & RLV_WEAR_REPLACE & eWearMask));
 			case LLAssetType::AT_CLOTHING:
-				return (RLV_WEAR_LOCKED != (gRlvWearableLocks.canWear(pItem) & eWearMask));
+				return (RLV_WEAR_LOCKED != (RlvWearableLocks::instance().canWear(pItem) & eWearMask));
 			case LLAssetType::AT_OBJECT:
-				return (RLV_WEAR_LOCKED != (gRlvAttachmentLocks.canAttach(pItem) & eWearMask));
+				return (RLV_WEAR_LOCKED != (RlvAttachmentLocks::instance().canAttach(pItem) & eWearMask));
 			case LLAssetType::AT_GESTURE:
 				return true;
 			default:
@@ -835,7 +835,7 @@ bool rlvPredCanRemoveItem(const LLUUID& idItem)
 	if (isAgentAvatarValid())
 	{
 		const LLViewerObject* pAttachObj = gAgentAvatarp->getWornAttachment(idItem);
-		return (pAttachObj) && (!gRlvAttachmentLocks.isLockedAttachment(pAttachObj));
+		return (pAttachObj) && (!RlvAttachmentLocks::instance().isLockedAttachment(pAttachObj));
 	}
 
 	return false;
@@ -850,9 +850,9 @@ bool rlvPredCanRemoveItem(const LLViewerInventoryItem* pItem)
 		{
 			case LLAssetType::AT_BODYPART:
 			case LLAssetType::AT_CLOTHING:
-				return gRlvWearableLocks.canRemove(pItem);
+				return RlvWearableLocks::instance().canRemove(pItem);
 			case LLAssetType::AT_OBJECT:
-				return gRlvAttachmentLocks.canDetach(pItem);
+				return RlvAttachmentLocks::instance().canDetach(pItem);
 			case LLAssetType::AT_GESTURE:
 				return true;
 			case LLAssetType::AT_LINK:
diff --git a/indra/newview/rlvfloaters.cpp b/indra/newview/rlvfloaters.cpp
index 1414a67ef3622982d9506f3c5c3a7e36369bddff..38e6a888b4b2d1b47b0d2c0fa1ed05a8fb072f4a 100644
--- a/indra/newview/rlvfloaters.cpp
+++ b/indra/newview/rlvfloaters.cpp
@@ -481,7 +481,7 @@ void RlvFloaterLocks::refreshAll()
 	sdColumns[0]["value"] = "Attachment";
 	sdColumns[1]["value"] = "rem";
 
-	const RlvAttachmentLocks::rlv_attachobjlock_map_t& attachObjRem = gRlvAttachmentLocks.getAttachObjLocks();
+	const RlvAttachmentLocks::rlv_attachobjlock_map_t& attachObjRem = RlvAttachmentLocks::instance().getAttachObjLocks();
 	for (RlvAttachmentLocks::rlv_attachobjlock_map_t::const_iterator itAttachObj = attachObjRem.begin(); 
 			itAttachObj != attachObjRem.end(); ++itAttachObj)
 	{
@@ -497,7 +497,7 @@ void RlvFloaterLocks::refreshAll()
 	sdColumns[0]["value"] = "Attachment Point";
 
 	sdColumns[1]["value"] = "add";
-	const RlvAttachmentLocks::rlv_attachptlock_map_t& attachPtAdd = gRlvAttachmentLocks.getAttachPtLocks(RLV_LOCK_ADD);
+	const RlvAttachmentLocks::rlv_attachptlock_map_t& attachPtAdd = RlvAttachmentLocks::instance().getAttachPtLocks(RLV_LOCK_ADD);
 	for (RlvAttachmentLocks::rlv_attachptlock_map_t::const_iterator itAttachPt = attachPtAdd.begin(); 
 			itAttachPt != attachPtAdd.end(); ++itAttachPt)
 	{
@@ -510,7 +510,7 @@ void RlvFloaterLocks::refreshAll()
 	}
 
 	sdColumns[1]["value"] = "rem";
-	const RlvAttachmentLocks::rlv_attachptlock_map_t& attachPtRem = gRlvAttachmentLocks.getAttachPtLocks(RLV_LOCK_REMOVE);
+	const RlvAttachmentLocks::rlv_attachptlock_map_t& attachPtRem = RlvAttachmentLocks::instance().getAttachPtLocks(RLV_LOCK_REMOVE);
 	for (RlvAttachmentLocks::rlv_attachptlock_map_t::const_iterator itAttachPt = attachPtRem.begin(); 
 			itAttachPt != attachPtRem.end(); ++itAttachPt)
 	{
@@ -528,7 +528,7 @@ void RlvFloaterLocks::refreshAll()
 	sdColumns[0]["value"] = "Wearable Type";
 
 	sdColumns[1]["value"] = "add";
-	const RlvWearableLocks::rlv_wearabletypelock_map_t& wearableTypeAdd = gRlvWearableLocks.getWearableTypeLocks(RLV_LOCK_ADD);
+	const RlvWearableLocks::rlv_wearabletypelock_map_t& wearableTypeAdd = RlvWearableLocks::instance().getWearableTypeLocks(RLV_LOCK_ADD);
 	for (RlvWearableLocks::rlv_wearabletypelock_map_t::const_iterator itWearableType = wearableTypeAdd.begin(); 
 			itWearableType != wearableTypeAdd.end(); ++itWearableType)
 	{
@@ -539,7 +539,7 @@ void RlvFloaterLocks::refreshAll()
 	}
 
 	sdColumns[1]["value"] = "rem";
-	const RlvWearableLocks::rlv_wearabletypelock_map_t& wearableTypeRem = gRlvWearableLocks.getWearableTypeLocks(RLV_LOCK_REMOVE);
+	const RlvWearableLocks::rlv_wearabletypelock_map_t& wearableTypeRem = RlvWearableLocks::instance().getWearableTypeLocks(RLV_LOCK_REMOVE);
 	for (RlvWearableLocks::rlv_wearabletypelock_map_t::const_iterator itWearableType = wearableTypeRem.begin(); 
 			itWearableType != wearableTypeRem.end(); ++itWearableType)
 	{
diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp
index 018d6077b32e91284f984369a4ab28e83ebeffd7..62f5aea5900b6f1c83d6949374cf56e39c7cc955 100644
--- a/indra/newview/rlvhandler.cpp
+++ b/indra/newview/rlvhandler.cpp
@@ -861,7 +861,7 @@ void RlvHandler::onAttach(const LLViewerObject* pAttachObj, const LLViewerJointA
 
 				// We need to check this object for an active "@detach=n" and actually lock it down now that it's been attached somewhere
 				if (itObj->second.hasBehaviour(RLV_BHVR_DETACH, false))
-					gRlvAttachmentLocks.addAttachmentLock(pAttachObj->getID(), itObj->second.getObjectID());
+					RlvAttachmentLocks::instance().addAttachmentLock(pAttachObj->getID(), itObj->second.getObjectID());
 			}
 		}
 	}
@@ -901,7 +901,7 @@ void RlvHandler::onDetach(const LLViewerObject* pAttachObj, const LLViewerJointA
 
 				// If this object has an active "@detach=n" then we need to release the attachment lock since it's no longer attached
 				if (itObj->second.hasBehaviour(RLV_BHVR_DETACH, false))
-					gRlvAttachmentLocks.removeAttachmentLock(pAttachObj->getID(), itObj->second.getObjectID());
+					RlvAttachmentLocks::instance().removeAttachmentLock(pAttachObj->getID(), itObj->second.getObjectID());
 			}
 		}
 	}
@@ -1008,12 +1008,12 @@ bool RlvHandler::onGC()
 				//	-> if it does run it likely means that there's a @detach=n in a *child* prim that we couldn't look up in onAttach()
 				//  -> since RLV doesn't currently support @detach=n from child prims it's actually not such a big deal right now but still
 				if ( (pObj->isAttachment()) && (itCurObj->second.hasBehaviour(RLV_BHVR_DETACH, false)) )
-					gRlvAttachmentLocks.addAttachmentLock(pObj->getID(), itCurObj->second.getObjectID());
+					RlvAttachmentLocks::instance().addAttachmentLock(pObj->getID(), itCurObj->second.getObjectID());
 			}
 		}
 	}
 
-	RLV_ASSERT(gRlvAttachmentLocks.verifyAttachmentLocks()); // Verify that we haven't leaked any attachment locks somehow
+	RLV_ASSERT(RlvAttachmentLocks::instance().verifyAttachmentLocks()); // Verify that we haven't leaked any attachment locks somehow
 
 	// Clean up pending temp attachments that we were never able to resolve
 	rlv_blocked_object_list_t::const_iterator itBlocked = m_BlockedObjects.cbegin(), itCurBlocked;
@@ -1305,8 +1305,8 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const
 		if ( (!pFolder) || (!pAvatar) )
 			return false;
 		// Sanity check - if nothing is locked then we can definitely take it off
-		if ( (!gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) || 
-			 (!gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_REMOVE)) )
+		if ( (!RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) || 
+			 (!RlvWearableLocks::instance().hasLockedWearableType(RLV_LOCK_REMOVE)) )
 		{
 			return true;
 		}
@@ -1353,7 +1353,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const
 		if ( (!pFolder) || (!pAvatar) )
 			return false;
 		// Sanity check - if nothing is locked then we can definitely wear it
-		if ( (!gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (!gRlvWearableLocks.hacLockedWearableType(RLV_LOCK_ANY)) )
+		if ( (!RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (!RlvWearableLocks::instance().hacLockedWearableType(RLV_LOCK_ANY)) )
 			return true;
 
 /*
@@ -1509,9 +1509,9 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
 					if ( (rlvCmdOption.isEmpty()) || ((LLWearableType::EType)idxType == rlvCmdOption.getWearableType()) )
 					{
 						if (RLV_TYPE_ADD == eType)
-							gRlvWearableLocks.addWearableTypeLock((LLWearableType::EType)idxType, rlvCmd.getObjectID(), eLock);
+							RlvWearableLocks::instance().addWearableTypeLock((LLWearableType::EType)idxType, rlvCmd.getObjectID(), eLock);
 						else
-							gRlvWearableLocks.removeWearableTypeLock((LLWearableType::EType)idxType, rlvCmd.getObjectID(), eLock);
+							RlvWearableLocks::instance().removeWearableTypeLock((LLWearableType::EType)idxType, rlvCmd.getObjectID(), eLock);
 					}
 				}
 			}
@@ -1779,9 +1779,9 @@ ERlvCmdRet RlvBehaviourAddRemAttachHandler::onCommand(const RlvCommand& rlvCmd,
 		if ( (0 == idxAttachPt) || (itAttach->first == idxAttachPt) )
 		{
 			if (RLV_TYPE_ADD == rlvCmd.getParamType())
-				gRlvAttachmentLocks.addAttachmentPointLock(itAttach->first, rlvCmd.getObjectID(), eLock);
+				RlvAttachmentLocks::instance().addAttachmentPointLock(itAttach->first, rlvCmd.getObjectID(), eLock);
 			else
-				gRlvAttachmentLocks.removeAttachmentPointLock(itAttach->first, rlvCmd.getObjectID(), eLock);
+				RlvAttachmentLocks::instance().removeAttachmentPointLock(itAttach->first, rlvCmd.getObjectID(), eLock);
 		}
 	}
 
@@ -1808,9 +1808,9 @@ ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_DETACH>::onCommand(const RlvCommand& rlv
 		if ( (itObj != gRlvHandler.m_Objects.end()) && (itObj->second.hasLookup()) && (itObj->second.getAttachPt()) )
 		{
 			if (RLV_TYPE_ADD == rlvCmd.getParamType())
-				gRlvAttachmentLocks.addAttachmentLock(itObj->second.getRootID(), itObj->first);
+				RlvAttachmentLocks::instance().addAttachmentLock(itObj->second.getRootID(), itObj->first);
 			else
-				gRlvAttachmentLocks.removeAttachmentLock(itObj->second.getRootID(), itObj->first);
+				RlvAttachmentLocks::instance().removeAttachmentLock(itObj->second.getRootID(), itObj->first);
 		}
 	}
 	else							// @detach:<attachpt>=n|y - RLV_LOCK_ADD and RLV_LOCK_REMOVE locks an attachment *point*
@@ -1821,9 +1821,9 @@ ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_DETACH>::onCommand(const RlvCommand& rlv
 			return RLV_RET_FAILED_OPTION;
 
 		if (RLV_TYPE_ADD == rlvCmd.getParamType())
-			gRlvAttachmentLocks.addAttachmentPointLock(idxAttachPt, rlvCmd.getObjectID(), (ERlvLockMask)(RLV_LOCK_ADD | RLV_LOCK_REMOVE));
+			RlvAttachmentLocks::instance().addAttachmentPointLock(idxAttachPt, rlvCmd.getObjectID(), (ERlvLockMask)(RLV_LOCK_ADD | RLV_LOCK_REMOVE));
 		else
-			gRlvAttachmentLocks.removeAttachmentPointLock(idxAttachPt, rlvCmd.getObjectID(), (ERlvLockMask)(RLV_LOCK_ADD | RLV_LOCK_REMOVE));
+			RlvAttachmentLocks::instance().removeAttachmentPointLock(idxAttachPt, rlvCmd.getObjectID(), (ERlvLockMask)(RLV_LOCK_ADD | RLV_LOCK_REMOVE));
 	}
 
 	fRefCount = false;	// Don't reference count @detach[:<option>]=n
@@ -3250,7 +3250,7 @@ ERlvCmdRet RlvHandler::onGetAttachNames(const RlvCommand& rlvCmd, std::string& s
 					fAdd = (pAttachPt->getNumObjects() > 0);
 					break;
 				case RLV_BHVR_GETADDATTACHNAMES:	// Every attachment point that can be attached to (wear replace OR wear add)
-					fAdd = (gRlvAttachmentLocks.canAttach(pAttachPt) & RLV_WEAR);
+					fAdd = (RlvAttachmentLocks::instance().canAttach(pAttachPt) & RLV_WEAR);
 					break;
 				case RLV_BHVR_GETREMATTACHNAMES:	// Every attachment point that has at least one attachment that can be force-detached
 					fAdd = RlvForceWear::isForceDetachable(pAttachPt);
@@ -3550,7 +3550,7 @@ ERlvCmdRet RlvHandler::onGetOutfitNames(const RlvCommand& rlvCmd, std::string& s
 				fAdd = (gAgentWearables.getWearableCount(wtType) > 0);
 				break;
 			case RLV_BHVR_GETADDOUTFITNAMES:	// Every layer that can be worn on (wear replace OR wear add)
-				fAdd = (gRlvWearableLocks.canWear(wtType) & RLV_WEAR);
+				fAdd = (RlvWearableLocks::instance().canWear(wtType) & RLV_WEAR);
 				break;
 			case RLV_BHVR_GETREMOUTFITNAMES:	// Every layer that has at least one wearable that can be force-removed
 				fAdd = RlvForceWear::isForceRemovable(wtType);
diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp
index a7d246293a742ad473d470d56af9132eada87c98..2bcba1632dfd9b86ed1b9598faab048bd09bdd8d 100644
--- a/indra/newview/rlvhelper.cpp
+++ b/indra/newview/rlvhelper.cpp
@@ -1147,7 +1147,7 @@ void RlvForceWear::forceFolder(const LLViewerInventoryCategory* pFolder, EWearAc
 					// The second time we encounter a given clothing type we'll always add (rather than replace the previous iteration)
 					eCurAction = (!fSeenWType[pItem->getWearableType()]) ? eCurAction : ACTION_WEAR_ADD;
 
-					ERlvWearMask eWearMask = gRlvWearableLocks.canWear(pRlvItem);
+					ERlvWearMask eWearMask = RlvWearableLocks::instance().canWear(pRlvItem);
 					if ( ((ACTION_WEAR_REPLACE == eCurAction) && (eWearMask & RLV_WEAR_REPLACE)) ||
 						 ((ACTION_WEAR_ADD == eCurAction) && (eWearMask & RLV_WEAR_ADD)) )
 					{
@@ -1168,7 +1168,7 @@ void RlvForceWear::forceFolder(const LLViewerInventoryCategory* pFolder, EWearAc
 			case LLAssetType::AT_OBJECT:
 				if (isWearAction(eAction))
 				{
-					ERlvWearMask eWearMask = gRlvAttachmentLocks.canAttach(pRlvItem);
+					ERlvWearMask eWearMask = RlvAttachmentLocks::instance().canAttach(pRlvItem);
 					if ( ((ACTION_WEAR_REPLACE == eCurAction) && (eWearMask & RLV_WEAR_REPLACE)) ||
 						 ((ACTION_WEAR_ADD == eCurAction) && (eWearMask & RLV_WEAR_ADD)) )
 					{
@@ -1237,8 +1237,8 @@ bool RlvForceWear::isForceDetachable(const LLViewerObject* pAttachObj, bool fChe
 	return 
 	  (
 		(pAttachObj) && (pAttachObj->isAttachment())
-		&& ( (idExcept.isNull()) ? (!gRlvAttachmentLocks.isLockedAttachment(pAttachObj))
-		                         : (!gRlvAttachmentLocks.isLockedAttachmentExcept(pAttachObj, idExcept)) )
+		&& ( (idExcept.isNull()) ? (!RlvAttachmentLocks::instance().isLockedAttachment(pAttachObj))
+		                         : (!RlvAttachmentLocks::instance().isLockedAttachmentExcept(pAttachObj, idExcept)) )
 		&& (isStrippable(pAttachObj->getAttachmentItemID()))
 		#ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS
 		&& ( (!fCheckComposite) || (!RlvSettings::getEnableComposites()) || 
@@ -1310,8 +1310,8 @@ bool RlvForceWear::isForceRemovable(const LLViewerWearable* pWearable, bool fChe
 	return 
 	  (
 		(pWearable) && (LLAssetType::AT_CLOTHING == pWearable->getAssetType()) 
-		&& ( (idExcept.isNull()) ? !gRlvWearableLocks.isLockedWearable(pWearable)
-		                         : !gRlvWearableLocks.isLockedWearableExcept(pWearable, idExcept) )
+		&& ( (idExcept.isNull()) ? !RlvWearableLocks::instance().isLockedWearable(pWearable)
+		                         : !RlvWearableLocks::instance().isLockedWearableExcept(pWearable, idExcept) )
 		&& (isStrippable(pWearable->getItemID()))
 		#ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS
 		&& ( (!fCheckComposite) || (!RlvSettings::getEnableComposites()) || 
diff --git a/indra/newview/rlvlocks.cpp b/indra/newview/rlvlocks.cpp
index 8263bbfd61732e4e00de6d2fd5f849081d0ae545..98f868e88a05da67951fea323cbb2f876fd66d72 100644
--- a/indra/newview/rlvlocks.cpp
+++ b/indra/newview/rlvlocks.cpp
@@ -172,8 +172,6 @@ S32 RlvAttachPtLookup::getAttachPointIndexLegacy(const LLInventoryCategory* pFol
 // RlvAttachmentLocks member functions
 //
 
-RlvAttachmentLocks gRlvAttachmentLocks;
-
 // Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
 void RlvAttachmentLocks::addAttachmentLock(const LLUUID& idAttachObj, const LLUUID& idRlvObj)
 {
@@ -628,7 +626,7 @@ void RlvAttachmentLockWatchdog::onAttach(const LLViewerObject* pAttachObj, const
 			for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator itAttachObj = pAttachPt->mAttachedObjects.begin();
 					((itAttachObj != pAttachPt->mAttachedObjects.end()) && (fAttachAllowed)); ++itAttachObj)
 			{
-				if ( (pAttachObj != *itAttachObj) && (gRlvAttachmentLocks.isLockedAttachment(*itAttachObj)) )
+				if ( (pAttachObj != *itAttachObj) && (RlvAttachmentLocks::instance().isLockedAttachment(*itAttachObj)) )
 				{
 					// Fail if we encounter a non-detachable attachment (unless we're only replacing detachable attachments)
 					if (gSavedSettings.getBOOL("RLVaWearReplaceUnlocked"))
@@ -673,7 +671,7 @@ void RlvAttachmentLockWatchdog::onDetach(const LLViewerObject* pAttachObj, const
 
 	// If the attachment is currently "remove locked" then we should reattach it (unless it's already pending reattach)
 	bool fDetachAllowed = true;
-	if (gRlvAttachmentLocks.isLockedAttachment(pAttachObj))
+	if (RlvAttachmentLocks::instance().isLockedAttachment(pAttachObj))
 	{
 		bool fPendingAttach = false;
 		for (rlv_attach_map_t::const_iterator itReattach = m_PendingAttach.lower_bound(idxAttachPt), 
@@ -768,7 +766,7 @@ void RlvAttachmentLockWatchdog::onWearAttachment(const LLUUID& idItem, ERlvWearM
 {
 	// We only need to keep track of user wears if there's actually anything locked
 	RLV_ASSERT(idItem.notNull());
-	if ( (idItem.isNull()) || (!isAgentAvatarValid()) || (!gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
+	if ( (idItem.isNull()) || (!isAgentAvatarValid()) || (!RlvAttachmentLocks::instance().hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
 		return;
 
 	// If the attachment point this will end up being attached to is:
@@ -784,7 +782,7 @@ void RlvAttachmentLockWatchdog::onWearAttachment(const LLUUID& idItem, ERlvWearM
 	{
 		const LLViewerJointAttachment* pAttachPt = itAttachPt->second;
 		// We only need to know which attachments were present for RLV_LOCK_ADD locked attachment points (and not RLV_LOCK_REM locked ones)
-		if (gRlvAttachmentLocks.isLockedAttachmentPoint(pAttachPt, RLV_LOCK_ADD))
+		if (RlvAttachmentLocks::instance().isLockedAttachmentPoint(pAttachPt, RLV_LOCK_ADD))
 		{
 			uuid_vec_t attachObjs;
 			for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator itAttachObj = pAttachPt->mAttachedObjects.begin();
@@ -810,8 +808,6 @@ void RlvAttachmentLockWatchdog::onWearAttachment(const LLUUID& idItem, ERlvWearM
 // RlvWearableLocks member functions
 //
 
-RlvWearableLocks gRlvWearableLocks;
-
 // Checked: 2010-03-18 (RLVa-1.2.0c) | Added: RLVa-1.2.0a
 void RlvWearableLocks::addWearableTypeLock(LLWearableType::EType eType, const LLUUID& idRlvObj, ERlvLockMask eLock)
 {
diff --git a/indra/newview/rlvlocks.h b/indra/newview/rlvlocks.h
index bd605ddde14966fe1f1aee26a8b6bf4d912edfeb..551a586bbfa163bb1619d74d0c849a64525f9e24 100644
--- a/indra/newview/rlvlocks.h
+++ b/indra/newview/rlvlocks.h
@@ -57,11 +57,9 @@ private:
 //
 
 // TODO-RLVa: [RLVa-1.2.1] Once everything is working for SL-2.0 thin out the member functions since a few of them are duplicates/unneeded
-class RlvAttachmentLocks
+class RlvAttachmentLocks final : public LLSingleton<RlvAttachmentLocks>
 {
-public:
-	RlvAttachmentLocks() : m_fHasLockedHUD(false) {}
-
+	LLSINGLETON_EMPTY_CTOR(RlvAttachmentLocks);
 public:
 	// Adds an RLV_LOCK_REMOVE lock (held by idRlvObj) for the attachment
 	void addAttachmentLock(const LLUUID& idAttachObj, const LLUUID& idRlvObj);
@@ -128,11 +126,9 @@ private:
 	rlv_attachptlock_map_t	m_AttachPtRem;		// Map of attachment points whose attachments can't be detached (idxAttachPt -> idObj)
 	rlv_attachobjlock_map_t	m_AttachObjRem;		// Map of attachments that can't be detached (idAttachObj -> idObj)
 
-	bool m_fHasLockedHUD;
+	bool m_fHasLockedHUD = false;
 };
 
-extern RlvAttachmentLocks gRlvAttachmentLocks;
-
 // ============================================================================
 // RlvAttachmentLockWatchdog - Self contained class that automagically takes care of enforcing attachment locks (ie reattach-on-detach)
 //
@@ -220,8 +216,9 @@ protected:
 // RlvWearableLocks class declaration - modelled on RlvAttachmentLocks (attach pt = wearable type - attachment = wearable)
 //
 
-class RlvWearableLocks
+class RlvWearableLocks final : public LLSingleton<RlvWearableLocks>
 {
+	LLSINGLETON_EMPTY_CTOR(RlvWearableLocks);
 public:
 	// Adds an eLock type lock (held by idRlvObj) for the wearable type
 	void addWearableTypeLock(LLWearableType::EType eType, const LLUUID& idRlvObj, ERlvLockMask eLock);
@@ -273,8 +270,6 @@ protected:
 	rlv_wearabletypelock_map_t m_WearableTypeRem;
 };
 
-extern RlvWearableLocks gRlvWearableLocks;
-
 // ============================================================================
 // RlvFolderLocks class declaration
 //