aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2010-07-20 05:59:18 -0700
committerDiva Canto2010-07-20 13:26:42 -0700
commitd93a442483a6afbcd85b881d2b168d25ac31f0ae (patch)
tree69f648bc94ad338b1ffa9091aede190ad0eb72ab /OpenSim
parentAnother stab at http://opensimulator.org/mantis/view.php?id=4858. Eliminated ... (diff)
downloadopensim-SC-d93a442483a6afbcd85b881d2b168d25ac31f0ae.zip
opensim-SC-d93a442483a6afbcd85b881d2b168d25ac31f0ae.tar.gz
opensim-SC-d93a442483a6afbcd85b881d2b168d25ac31f0ae.tar.bz2
opensim-SC-d93a442483a6afbcd85b881d2b168d25ac31f0ae.tar.xz
Relaxed the ultra-conservative lock on m_items. Needs testing under linux and stress.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs407
1 files changed, 188 insertions, 219 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3519d4b..20d5486 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -118,20 +118,20 @@ namespace OpenSim.Region.Framework.Scenes
118 /// <param name="linkNum">Link number for the part</param> 118 /// <param name="linkNum">Link number for the part</param>
119 public void ResetInventoryIDs() 119 public void ResetInventoryIDs()
120 { 120 {
121 lock (Items) 121 lock (m_items)
122 { 122 {
123 if (0 == Items.Count) 123 if (0 == m_items.Count)
124 return; 124 return;
125 125
126 HasInventoryChanged = true; 126 HasInventoryChanged = true;
127 m_part.ParentGroup.HasGroupChanged = true; 127 m_part.ParentGroup.HasGroupChanged = true;
128 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 128 IList<TaskInventoryItem> items = GetInventoryItems();
129 Items.Clear(); 129 m_items.Clear();
130 130
131 foreach (TaskInventoryItem item in items) 131 foreach (TaskInventoryItem item in items)
132 { 132 {
133 item.ResetIDs(m_part.UUID); 133 item.ResetIDs(m_part.UUID);
134 Items.Add(item.ItemID, item); 134 m_items.Add(item.ItemID, item);
135 } 135 }
136 } 136 }
137 } 137 }
@@ -148,17 +148,17 @@ namespace OpenSim.Region.Framework.Scenes
148 { 148 {
149 return; 149 return;
150 } 150 }
151 }
151 152
152 HasInventoryChanged = true; 153 HasInventoryChanged = true;
153 m_part.ParentGroup.HasGroupChanged = true; 154 m_part.ParentGroup.HasGroupChanged = true;
154 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 155 List<TaskInventoryItem> items = GetInventoryItems();
155 foreach (TaskInventoryItem item in items) 156 foreach (TaskInventoryItem item in items)
157 {
158 if (ownerId != item.OwnerID)
156 { 159 {
157 if (ownerId != item.OwnerID) 160 item.LastOwnerID = item.OwnerID;
158 { 161 item.OwnerID = ownerId;
159 item.LastOwnerID = item.OwnerID;
160 item.OwnerID = ownerId;
161 }
162 } 162 }
163 } 163 }
164 } 164 }
@@ -175,17 +175,15 @@ namespace OpenSim.Region.Framework.Scenes
175 { 175 {
176 return; 176 return;
177 } 177 }
178 }
178 179
179 HasInventoryChanged = true; 180 HasInventoryChanged = true;
180 m_part.ParentGroup.HasGroupChanged = true; 181 m_part.ParentGroup.HasGroupChanged = true;
181 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 182 List<TaskInventoryItem> items = GetInventoryItems();
182 foreach (TaskInventoryItem item in items) 183 foreach (TaskInventoryItem item in items)
183 { 184 {
184 if (groupID != item.GroupID) 185 if (groupID != item.GroupID)
185 { 186 item.GroupID = groupID;
186 item.GroupID = groupID;
187 }
188 }
189 } 187 }
190 } 188 }
191 189
@@ -194,16 +192,9 @@ namespace OpenSim.Region.Framework.Scenes
194 /// </summary> 192 /// </summary>
195 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) 193 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
196 { 194 {
197 lock (m_items) 195 List<TaskInventoryItem> scripts = GetInventoryScripts();
198 { 196 foreach (TaskInventoryItem item in scripts)
199 foreach (TaskInventoryItem item in Items.Values) 197 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
200 {
201 if ((int)InventoryType.LSL == item.InvType)
202 {
203 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
204 }
205 }
206 }
207 } 198 }
208 199
209 public ArrayList GetScriptErrors(UUID itemID) 200 public ArrayList GetScriptErrors(UUID itemID)
@@ -236,16 +227,9 @@ namespace OpenSim.Region.Framework.Scenes
236 /// </param> 227 /// </param>
237 public void RemoveScriptInstances(bool sceneObjectBeingDeleted) 228 public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
238 { 229 {
239 lock (Items) 230 List<TaskInventoryItem> scripts = GetInventoryScripts();
240 { 231 foreach (TaskInventoryItem item in scripts)
241 foreach (TaskInventoryItem item in Items.Values) 232 RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
242 {
243 if ((int)InventoryType.LSL == item.InvType)
244 {
245 RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
246 }
247 }
248 }
249 } 233 }
250 234
251 /// <summary> 235 /// <summary>
@@ -375,21 +359,15 @@ namespace OpenSim.Region.Framework.Scenes
375 /// </param> 359 /// </param>
376 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 360 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
377 { 361 {
378 lock (m_items) 362 TaskInventoryItem item = GetInventoryItem(itemId);
379 { 363 if (item != null)
380 if (m_items.ContainsKey(itemId)) 364 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
381 { 365 else
382 CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource); 366 m_log.ErrorFormat(
383 } 367 "[PRIM INVENTORY]: " +
384 else 368 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
385 { 369 itemId, m_part.Name, m_part.UUID,
386 m_log.ErrorFormat( 370 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
387 "[PRIM INVENTORY]: " +
388 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
389 itemId, m_part.Name, m_part.UUID,
390 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
391 }
392 }
393 } 371 }
394 372
395 /// <summary> 373 /// <summary>
@@ -430,16 +408,18 @@ namespace OpenSim.Region.Framework.Scenes
430 408
431 /// <summary> 409 /// <summary>
432 /// Check if the inventory holds an item with a given name. 410 /// Check if the inventory holds an item with a given name.
433 /// This method assumes that the task inventory is already locked.
434 /// </summary> 411 /// </summary>
435 /// <param name="name"></param> 412 /// <param name="name"></param>
436 /// <returns></returns> 413 /// <returns></returns>
437 private bool InventoryContainsName(string name) 414 private bool InventoryContainsName(string name)
438 { 415 {
439 foreach (TaskInventoryItem item in Items.Values) 416 lock (m_items)
440 { 417 {
441 if (item.Name == name) 418 foreach (TaskInventoryItem item in m_items.Values)
442 return true; 419 {
420 if (item.Name == name)
421 return true;
422 }
443 } 423 }
444 return false; 424 return false;
445 } 425 }
@@ -482,12 +462,7 @@ namespace OpenSim.Region.Framework.Scenes
482 /// <param name="item"></param> 462 /// <param name="item"></param>
483 public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) 463 public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
484 { 464 {
485 List<TaskInventoryItem> il; 465 List<TaskInventoryItem> il = GetInventoryItems();
486
487 lock (m_items)
488 {
489 il = new List<TaskInventoryItem>(m_items.Values);
490 }
491 466
492 foreach (TaskInventoryItem i in il) 467 foreach (TaskInventoryItem i in il)
493 { 468 {
@@ -527,14 +502,12 @@ namespace OpenSim.Region.Framework.Scenes
527 item.GroupID = m_part.GroupID; 502 item.GroupID = m_part.GroupID;
528 503
529 lock (m_items) 504 lock (m_items)
530 {
531 m_items.Add(item.ItemID, item); 505 m_items.Add(item.ItemID, item);
532 506
533 if (allowedDrop) 507 if (allowedDrop)
534 m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP); 508 m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
535 else 509 else
536 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 510 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
537 }
538 511
539 m_inventorySerial++; 512 m_inventorySerial++;
540 //m_inventorySerial += 2; 513 //m_inventorySerial += 2;
@@ -558,9 +531,8 @@ namespace OpenSim.Region.Framework.Scenes
558 m_items.Add(item.ItemID, item); 531 m_items.Add(item.ItemID, item);
559// m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 532// m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
560 } 533 }
534 m_inventorySerial++;
561 } 535 }
562
563 m_inventorySerial++;
564 } 536 }
565 537
566 /// <summary> 538 /// <summary>
@@ -615,45 +587,44 @@ namespace OpenSim.Region.Framework.Scenes
615 587
616 public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) 588 public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents)
617 { 589 {
618 lock(m_items) 590 TaskInventoryItem it = GetInventoryItem(item.ItemID);
591 if (it != null)
619 { 592 {
620 if (m_items.ContainsKey(item.ItemID)) 593 item.ParentID = m_part.UUID;
621 { 594 item.ParentPartID = m_part.UUID;
622 if (m_items.ContainsKey(item.ItemID)) 595 item.Flags = m_items[item.ItemID].Flags;
623 { 596
624 item.ParentID = m_part.UUID; 597 // If group permissions have been set on, check that the groupID is up to date in case it has
625 item.ParentPartID = m_part.UUID; 598 // changed since permissions were last set.
626 item.Flags = m_items[item.ItemID].Flags; 599 if (item.GroupPermissions != (uint)PermissionMask.None)
627 600 item.GroupID = m_part.GroupID;
628 // If group permissions have been set on, check that the groupID is up to date in case it has
629 // changed since permissions were last set.
630 if (item.GroupPermissions != (uint)PermissionMask.None)
631 item.GroupID = m_part.GroupID;
632 601
633 if (item.AssetID == UUID.Zero) 602 if (item.AssetID == UUID.Zero)
634 { 603 item.AssetID = it.AssetID;
635 item.AssetID = m_items[item.ItemID].AssetID;
636 }
637 m_items[item.ItemID] = item;
638 m_inventorySerial++;
639 if (fireScriptEvents)
640 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
641 HasInventoryChanged = true;
642 m_part.ParentGroup.HasGroupChanged = true;
643 return true;
644 }
645 else
646 {
647 m_log.ErrorFormat(
648 "[PRIM INVENTORY]: " +
649 "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
650 item.ItemID, m_part.Name, m_part.UUID,
651 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
652 }
653 604
605 lock (m_items)
606 {
607 m_items[item.ItemID] = item;
608 m_inventorySerial++;
654 } 609 }
655 return false; 610
611 if (fireScriptEvents)
612 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
613
614 HasInventoryChanged = true;
615 m_part.ParentGroup.HasGroupChanged = true;
616 return true;
617 }
618 else
619 {
620 m_log.ErrorFormat(
621 "[PRIM INVENTORY]: " +
622 "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
623 item.ItemID, m_part.Name, m_part.UUID,
624 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
656 } 625 }
626 return false;
627
657 } 628 }
658 629
659 /// <summary> 630 /// <summary>
@@ -664,52 +635,37 @@ namespace OpenSim.Region.Framework.Scenes
664 /// in this prim's inventory.</returns> 635 /// in this prim's inventory.</returns>
665 public int RemoveInventoryItem(UUID itemID) 636 public int RemoveInventoryItem(UUID itemID)
666 { 637 {
667 lock (m_items) 638 TaskInventoryItem item = GetInventoryItem(itemID);
639 if (item != null)
668 { 640 {
669 if (m_items.ContainsKey(itemID)) 641 int type = m_items[itemID].InvType;
642 if (type == 10) // Script
670 { 643 {
671 int type = m_items[itemID].InvType; 644 m_part.RemoveScriptEvents(itemID);
672 if (type == 10) // Script 645 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
673 { 646 }
674 m_part.RemoveScriptEvents(itemID); 647 m_items.Remove(itemID);
675 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); 648 m_inventorySerial++;
676 } 649 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
677 m_items.Remove(itemID);
678 m_inventorySerial++;
679 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
680
681 HasInventoryChanged = true;
682 m_part.ParentGroup.HasGroupChanged = true;
683 650
684 int scriptcount = 0; 651 HasInventoryChanged = true;
685 lock (m_items) 652 m_part.ParentGroup.HasGroupChanged = true;
686 {
687 foreach (TaskInventoryItem item in m_items.Values)
688 {
689 if (item.Type == 10)
690 {
691 scriptcount++;
692 }
693 }
694 }
695 653
696 if (scriptcount <= 0) 654 if (!ContainsScripts())
697 { 655 m_part.RemFlag(PrimFlags.Scripted);
698 m_part.RemFlag(PrimFlags.Scripted);
699 }
700 656
701 m_part.ScheduleFullUpdate(); 657 m_part.ScheduleFullUpdate();
702 658
703 return type; 659 return type;
704 } 660
705 else 661 }
706 { 662 else
707 m_log.ErrorFormat( 663 {
708 "[PRIM INVENTORY]: " + 664 m_log.ErrorFormat(
709 "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", 665 "[PRIM INVENTORY]: " +
710 itemID, m_part.Name, m_part.UUID, 666 "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
711 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); 667 itemID, m_part.Name, m_part.UUID,
712 } 668 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
713 } 669 }
714 670
715 return -1; 671 return -1;
@@ -763,52 +719,50 @@ namespace OpenSim.Region.Framework.Scenes
763 // isn't available (such as drag from prim inventory to agent inventory) 719 // isn't available (such as drag from prim inventory to agent inventory)
764 InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); 720 InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
765 721
766 lock (m_items) 722 List<TaskInventoryItem> items = GetInventoryItems();
723 foreach (TaskInventoryItem item in items)
767 { 724 {
768 foreach (TaskInventoryItem item in m_items.Values) 725 UUID ownerID = item.OwnerID;
769 { 726 uint everyoneMask = 0;
770 UUID ownerID = item.OwnerID; 727 uint baseMask = item.BasePermissions;
771 uint everyoneMask = 0; 728 uint ownerMask = item.CurrentPermissions;
772 uint baseMask = item.BasePermissions; 729 uint groupMask = item.GroupPermissions;
773 uint ownerMask = item.CurrentPermissions;
774 uint groupMask = item.GroupPermissions;
775 730
776 invString.AddItemStart(); 731 invString.AddItemStart();
777 invString.AddNameValueLine("item_id", item.ItemID.ToString()); 732 invString.AddNameValueLine("item_id", item.ItemID.ToString());
778 invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); 733 invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
779 734
780 invString.AddPermissionsStart(); 735 invString.AddPermissionsStart();
781 736
782 invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); 737 invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
783 invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); 738 invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
784 invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); 739 invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask));
785 invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); 740 invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
786 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); 741 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
787 742
788 invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); 743 invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
789 invString.AddNameValueLine("owner_id", ownerID.ToString()); 744 invString.AddNameValueLine("owner_id", ownerID.ToString());
790 745
791 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); 746 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
792 747
793 invString.AddNameValueLine("group_id", item.GroupID.ToString()); 748 invString.AddNameValueLine("group_id", item.GroupID.ToString());
794 invString.AddSectionEnd(); 749 invString.AddSectionEnd();
795 750
796 invString.AddNameValueLine("asset_id", item.AssetID.ToString()); 751 invString.AddNameValueLine("asset_id", item.AssetID.ToString());
797 invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); 752 invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
798 invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); 753 invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
799 invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); 754 invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
800 755
801 invString.AddSaleStart(); 756 invString.AddSaleStart();
802 invString.AddNameValueLine("sale_type", "not"); 757 invString.AddNameValueLine("sale_type", "not");
803 invString.AddNameValueLine("sale_price", "0"); 758 invString.AddNameValueLine("sale_price", "0");
804 invString.AddSectionEnd(); 759 invString.AddSectionEnd();
805 760
806 invString.AddNameValueLine("name", item.Name + "|"); 761 invString.AddNameValueLine("name", item.Name + "|");
807 invString.AddNameValueLine("desc", item.Description + "|"); 762 invString.AddNameValueLine("desc", item.Description + "|");
808 763
809 invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); 764 invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
810 invString.AddSectionEnd(); 765 invString.AddSectionEnd();
811 }
812 } 766 }
813 767
814 fileData = Utils.StringToBytes(invString.BuildString); 768 fileData = Utils.StringToBytes(invString.BuildString);
@@ -830,12 +784,10 @@ namespace OpenSim.Region.Framework.Scenes
830 { 784 {
831 if (HasInventoryChanged) 785 if (HasInventoryChanged)
832 { 786 {
833 lock (Items)
834 {
835 datastore.StorePrimInventory(m_part.UUID, Items.Values);
836 }
837
838 HasInventoryChanged = false; 787 HasInventoryChanged = false;
788 List<TaskInventoryItem> items = GetInventoryItems();
789 datastore.StorePrimInventory(m_part.UUID, items);
790
839 } 791 }
840 } 792 }
841 793
@@ -1001,6 +953,30 @@ namespace OpenSim.Region.Framework.Scenes
1001 953
1002 return ret; 954 return ret;
1003 } 955 }
956
957 public List<TaskInventoryItem> GetInventoryItems()
958 {
959 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
960
961 lock (m_items)
962 ret = new List<TaskInventoryItem>(m_items.Values);
963
964 return ret;
965 }
966
967 public List<TaskInventoryItem> GetInventoryScripts()
968 {
969 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
970
971 lock (m_items)
972 {
973 foreach (TaskInventoryItem item in m_items.Values)
974 if (item.InvType == (int)InventoryType.LSL)
975 ret.Add(item);
976 }
977
978 return ret;
979 }
1004 980
1005 public Dictionary<UUID, string> GetScriptStates() 981 public Dictionary<UUID, string> GetScriptStates()
1006 { 982 {
@@ -1010,24 +986,20 @@ namespace OpenSim.Region.Framework.Scenes
1010 if (engines == null) // No engine at all 986 if (engines == null) // No engine at all
1011 return ret; 987 return ret;
1012 988
1013 lock (m_items) 989 List<TaskInventoryItem> scripts = GetInventoryScripts();
990
991 foreach (TaskInventoryItem item in scripts)
1014 { 992 {
1015 foreach (TaskInventoryItem item in m_items.Values) 993 foreach (IScriptModule e in engines)
1016 { 994 {
1017 if (item.InvType == (int)InventoryType.LSL) 995 if (e != null)
1018 { 996 {
1019 foreach (IScriptModule e in engines) 997 string n = e.GetXMLState(item.ItemID);
998 if (n != String.Empty)
1020 { 999 {
1021 if (e != null) 1000 if (!ret.ContainsKey(item.ItemID))
1022 { 1001 ret[item.ItemID] = n;
1023 string n = e.GetXMLState(item.ItemID); 1002 break;
1024 if (n != String.Empty)
1025 {
1026 if (!ret.ContainsKey(item.ItemID))
1027 ret[item.ItemID] = n;
1028 break;
1029 }
1030 }
1031 } 1003 }
1032 } 1004 }
1033 } 1005 }
@@ -1042,25 +1014,22 @@ namespace OpenSim.Region.Framework.Scenes
1042 if (engines == null) 1014 if (engines == null)
1043 return; 1015 return;
1044 1016
1045 lock (m_items) 1017 List<TaskInventoryItem> scripts = GetInventoryScripts();
1018
1019 foreach (TaskInventoryItem item in scripts)
1046 { 1020 {
1047 foreach (TaskInventoryItem item in m_items.Values) 1021 foreach (IScriptModule engine in engines)
1048 { 1022 {
1049 if (item.InvType == (int)InventoryType.LSL) 1023 if (engine != null)
1050 { 1024 {
1051 foreach (IScriptModule engine in engines) 1025 if (item.OwnerChanged)
1052 { 1026 engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
1053 if (engine != null) 1027 item.OwnerChanged = false;
1054 { 1028 engine.ResumeScript(item.ItemID);
1055 if (item.OwnerChanged)
1056 engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
1057 item.OwnerChanged = false;
1058 engine.ResumeScript(item.ItemID);
1059 }
1060 }
1061 } 1029 }
1062 } 1030 }
1063 } 1031 }
1064 } 1032 }
1033
1065 } 1034 }
1066} 1035}