From eeb09f33e3230001b23da4f97a23e45b3f2c333e Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 3 May 2011 13:54:59 -0700 Subject: [PATCH] Add locking on m_primSyncInfoLock in InitPropertiesBySync and InitPropertiesSyncInfoFromOSDMap. --- .../SymmetricSync/RegionSyncModule.cs | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 5972caa186..e0b23184aa 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -5190,11 +5190,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule else initPrimProperties = FullSetPrimProperties; - foreach (SceneObjectPartSyncProperties property in initPrimProperties) + lock (m_primSyncInfoLock) { - Object initValue = GetSOPPropertyValue(part, property); - PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, initUpdateTimestamp, syncID); - m_propertiesSyncInfo.Add(property, syncInfo); + foreach (SceneObjectPartSyncProperties property in initPrimProperties) + { + Object initValue = GetSOPPropertyValue(part, property); + PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, initUpdateTimestamp, syncID); + m_propertiesSyncInfo.Add(property, syncInfo); + } } } @@ -5205,18 +5208,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// private void InitPropertiesSyncInfoFromOSDMap(OSDMap primSyncInfoData) { - m_propertiesSyncInfo.Clear(); - foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) + lock (m_primSyncInfoLock) { - if (primSyncInfoData.ContainsKey(property.ToString())) + m_propertiesSyncInfo.Clear(); + foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) { - PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[property.ToString()]); - m_propertiesSyncInfo.Add(property, propertySyncInfo); - } - else - { - //For Phantom prims, they don't have PhysActor properties. So this branch could happen. - //DebugLog.WarnFormat("InitPropertiesSyncInfoFromOSDMap: Property {0} not included in the given OSDMap", property); + if (primSyncInfoData.ContainsKey(property.ToString())) + { + PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[property.ToString()]); + m_propertiesSyncInfo.Add(property, propertySyncInfo); + } + else + { + //For Phantom prims, they don't have PhysActor properties. So this branch could happen. + //DebugLog.WarnFormat("InitPropertiesSyncInfoFromOSDMap: Property {0} not included in the given OSDMap", property); + } } } }