aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-20 14:04:29 +0000
committerJustin Clarke Casey2009-02-20 14:04:29 +0000
commit01f70de2ea562f78991084be01a83295f8f2be0b (patch)
treeff43706bf83039ce9d9c6c5bfffe56f2df1d1c86 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentRevert previous commit (diff)
downloadopensim-SC-01f70de2ea562f78991084be01a83295f8f2be0b.zip
opensim-SC-01f70de2ea562f78991084be01a83295f8f2be0b.tar.gz
opensim-SC-01f70de2ea562f78991084be01a83295f8f2be0b.tar.bz2
opensim-SC-01f70de2ea562f78991084be01a83295f8f2be0b.tar.xz
* Consistently lock part.TaskInventory as pointed out in http://opensimulator.org/mantis/view.php?id=3159
* Not locking causes enumeration exceptions as described in this matis * part.TaskInventory needs to be locked for every access as it's a dictionary * Extra locking will hopefully not cause any major issues - in places where the enumeration of the dictionary performs other lock or long running operations, the dictionary is cloned instead
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs34
1 files changed, 21 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ec3fdf1..27c22eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1710,12 +1710,15 @@ if (m_shape != null) {
1710 info.AddValue("m_inventoryFileName", Inventory.GetInventoryFileName()); 1710 info.AddValue("m_inventoryFileName", Inventory.GetInventoryFileName());
1711 info.AddValue("m_folderID", UUID); 1711 info.AddValue("m_folderID", UUID);
1712 info.AddValue("PhysActor", PhysActor); 1712 info.AddValue("PhysActor", PhysActor);
1713 1713
1714 Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); 1714 Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>();
1715 1715
1716 foreach (UUID id in TaskInventory.Keys) 1716 lock (TaskInventory)
1717 { 1717 {
1718 TaskInventory_work.Add(id.Guid, TaskInventory[id]); 1718 foreach (UUID id in TaskInventory.Keys)
1719 {
1720 TaskInventory_work.Add(id.Guid, TaskInventory[id]);
1721 }
1719 } 1722 }
1720 1723
1721 info.AddValue("TaskInventory", TaskInventory_work); 1724 info.AddValue("TaskInventory", TaskInventory_work);
@@ -2166,13 +2169,16 @@ if (m_shape != null) {
2166 { 2169 {
2167 //Trys to fetch sound id from prim's inventory. 2170 //Trys to fetch sound id from prim's inventory.
2168 //Prim's inventory doesn't support non script items yet 2171 //Prim's inventory doesn't support non script items yet
2169 SceneObjectPart op = this; 2172
2170 foreach (KeyValuePair<UUID, TaskInventoryItem> item in op.TaskInventory) 2173 lock (TaskInventory)
2171 { 2174 {
2172 if (item.Value.Name == sound) 2175 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2173 { 2176 {
2174 soundID = item.Value.ItemID; 2177 if (item.Value.Name == sound)
2175 break; 2178 {
2179 soundID = item.Value.ItemID;
2180 break;
2181 }
2176 } 2182 }
2177 } 2183 }
2178 } 2184 }
@@ -2486,13 +2492,15 @@ if (m_shape != null) {
2486 if (!UUID.TryParse(sound, out soundID)) 2492 if (!UUID.TryParse(sound, out soundID))
2487 { 2493 {
2488 // search sound file from inventory 2494 // search sound file from inventory
2489 SceneObjectPart op = this; 2495 lock (TaskInventory)
2490 foreach (KeyValuePair<UUID, TaskInventoryItem> item in op.TaskInventory)
2491 { 2496 {
2492 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2497 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2493 { 2498 {
2494 soundID = item.Value.ItemID; 2499 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2495 break; 2500 {
2501 soundID = item.Value.ItemID;
2502 break;
2503 }
2496 } 2504 }
2497 } 2505 }
2498 } 2506 }