aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs48
1 files changed, 23 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 7328a39..2fa9139 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -505,35 +505,24 @@ namespace OpenSim.Region.Framework.Scenes
505 private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 505 private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
506 { 506 {
507 m_items.LockItemsForRead(true); 507 m_items.LockItemsForRead(true);
508
508 if (m_items.ContainsKey(itemId)) 509 if (m_items.ContainsKey(itemId))
509 { 510 {
510 if (m_items.ContainsKey(itemId)) 511 TaskInventoryItem it = m_items[itemId];
511 { 512 m_items.LockItemsForRead(false);
512 m_items.LockItemsForRead(false); 513
513 CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource); 514 CreateScriptInstance(it, startParam, postOnRez, engine, stateSource);
514 }
515 else
516 {
517 m_items.LockItemsForRead(false);
518 string msg = String.Format("couldn't be found for prim {0}, {1} at {2} in {3}", m_part.Name, m_part.UUID,
519 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
520 StoreScriptError(itemId, msg);
521 m_log.ErrorFormat(
522 "[PRIM INVENTORY]: " +
523 "Couldn't start script with ID {0} since it {1}", itemId, msg);
524 }
525 } 515 }
526 else 516 else
527 { 517 {
528 m_items.LockItemsForRead(false); 518 m_items.LockItemsForRead(false);
529 string msg = String.Format("couldn't be found for prim {0}, {1}", m_part.Name, m_part.UUID); 519 string msg = String.Format("couldn't be found for prim {0}, {1} at {2} in {3}", m_part.Name, m_part.UUID,
520 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
530 StoreScriptError(itemId, msg); 521 StoreScriptError(itemId, msg);
531 m_log.ErrorFormat( 522 m_log.ErrorFormat(
532 "[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", 523 "[PRIM INVENTORY]: " +
533 itemId, m_part.Name, m_part.UUID, 524 "Couldn't start script with ID {0} since it {1}", itemId, msg);
534 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
535 } 525 }
536
537 } 526 }
538 527
539 /// <summary> 528 /// <summary>
@@ -1144,26 +1133,28 @@ namespace OpenSim.Region.Framework.Scenes
1144 1133
1145 if (m_inventorySerial == 0) // No inventory 1134 if (m_inventorySerial == 0) // No inventory
1146 { 1135 {
1147 client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
1148 Items.LockItemsForRead(false); 1136 Items.LockItemsForRead(false);
1137 client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
1138
1149 return; 1139 return;
1150 } 1140 }
1151 1141
1152 if (m_items.Count == 0) // No inventory 1142 if (m_items.Count == 0) // No inventory
1153 { 1143 {
1154 client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
1155 Items.LockItemsForRead(false); 1144 Items.LockItemsForRead(false);
1145 client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
1156 return; 1146 return;
1157 } 1147 }
1158 1148
1159 if (!changed) 1149 if (!changed)
1160 { 1150 {
1151 Items.LockItemsForRead(false);
1152
1161 xferManager.AddNewFile(filename, 1153 xferManager.AddNewFile(filename,
1162 m_inventoryFileData); 1154 m_inventoryFileData);
1163 client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial, 1155 client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
1164 Util.StringToBytes256(filename)); 1156 Util.StringToBytes256(filename));
1165 1157
1166 Items.LockItemsForRead(false);
1167 return; 1158 return;
1168 } 1159 }
1169 1160
@@ -1249,10 +1240,17 @@ namespace OpenSim.Region.Framework.Scenes
1249// if (HasInventoryChanged) 1240// if (HasInventoryChanged)
1250// { 1241// {
1251 Items.LockItemsForRead(true); 1242 Items.LockItemsForRead(true);
1252 datastore.StorePrimInventory(m_part.UUID, Items.Values); 1243 try
1253 Items.LockItemsForRead(false); 1244 {
1245 datastore.StorePrimInventory(m_part.UUID, Items.Values);
1246 }
1247 catch {}
1254 1248
1255 HasInventoryChanged = false; 1249 HasInventoryChanged = false;
1250
1251 Items.LockItemsForRead(false);
1252
1253
1256// } 1254// }
1257 } 1255 }
1258 1256