aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2010-07-20 05:59:18 -0700
committerDiva Canto2010-07-20 05:59:18 -0700
commit7c124a5543534dde332d90e07dd72d9b52108836 (patch)
treea64edf52c1c0b03aa5b5ea0d3eaf1e3b621bef70
parentAdding it again. (diff)
downloadopensim-SC-7c124a5543534dde332d90e07dd72d9b52108836.zip
opensim-SC-7c124a5543534dde332d90e07dd72d9b52108836.tar.gz
opensim-SC-7c124a5543534dde332d90e07dd72d9b52108836.tar.bz2
opensim-SC-7c124a5543534dde332d90e07dd72d9b52108836.tar.xz
Relaxed the ultra-conservative lock on m_items. Needs testing under linux and stress.
-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 b27dc59..517b387 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
@@ -1000,6 +952,30 @@ namespace OpenSim.Region.Framework.Scenes
1000 952
1001 return ret; 953 return ret;
1002 } 954 }
955
956 public List<TaskInventoryItem> GetInventoryItems()
957 {
958 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
959
960 lock (m_items)
961 ret = new List<TaskInventoryItem>(m_items.Values);
962
963 return ret;
964 }
965
966 public List<TaskInventoryItem> GetInventoryScripts()
967 {
968 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
969
970 lock (m_items)
971 {
972 foreach (TaskInventoryItem item in m_items.Values)
973 if (item.InvType == (int)InventoryType.LSL)
974 ret.Add(item);
975 }
976
977 return ret;
978 }
1003 979
1004 public Dictionary<UUID, string> GetScriptStates() 980 public Dictionary<UUID, string> GetScriptStates()
1005 { 981 {
@@ -1009,24 +985,20 @@ namespace OpenSim.Region.Framework.Scenes
1009 if (engines == null) // No engine at all 985 if (engines == null) // No engine at all
1010 return ret; 986 return ret;
1011 987
1012 lock (m_items) 988 List<TaskInventoryItem> scripts = GetInventoryScripts();
989
990 foreach (TaskInventoryItem item in scripts)
1013 { 991 {
1014 foreach (TaskInventoryItem item in m_items.Values) 992 foreach (IScriptModule e in engines)
1015 { 993 {
1016 if (item.InvType == (int)InventoryType.LSL) 994 if (e != null)
1017 { 995 {
1018 foreach (IScriptModule e in engines) 996 string n = e.GetXMLState(item.ItemID);
997 if (n != String.Empty)
1019 { 998 {
1020 if (e != null) 999 if (!ret.ContainsKey(item.ItemID))
1021 { 1000 ret[item.ItemID] = n;
1022 string n = e.GetXMLState(item.ItemID); 1001 break;
1023 if (n != String.Empty)
1024 {
1025 if (!ret.ContainsKey(item.ItemID))
1026 ret[item.ItemID] = n;
1027 break;
1028 }
1029 }
1030 } 1002 }
1031 } 1003 }
1032 } 1004 }
@@ -1041,25 +1013,22 @@ namespace OpenSim.Region.Framework.Scenes
1041 if (engines == null) 1013 if (engines == null)
1042 return; 1014 return;
1043 1015
1044 lock (m_items) 1016 List<TaskInventoryItem> scripts = GetInventoryScripts();
1017
1018 foreach (TaskInventoryItem item in scripts)
1045 { 1019 {
1046 foreach (TaskInventoryItem item in m_items.Values) 1020 foreach (IScriptModule engine in engines)
1047 { 1021 {
1048 if (item.InvType == (int)InventoryType.LSL) 1022 if (engine != null)
1049 { 1023 {
1050 foreach (IScriptModule engine in engines) 1024 if (item.OwnerChanged)
1051 { 1025 engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
1052 if (engine != null) 1026 item.OwnerChanged = false;
1053 { 1027 engine.ResumeScript(item.ItemID);
1054 if (item.OwnerChanged)
1055 engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
1056 item.OwnerChanged = false;
1057 engine.ResumeScript(item.ItemID);
1058 }
1059 }
1060 } 1028 }
1061 } 1029 }
1062 } 1030 }
1063 } 1031 }
1032
1064 } 1033 }
1065} 1034}