aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-01-25 21:51:58 +0000
committerJustin Clark-Casey (justincc)2010-01-25 21:51:58 +0000
commit38cfc9366ce264d2aeb6409df48be7cecc348952 (patch)
tree2f90126ff91a339436d93f1c7d13fd69e1a44f24
parent* Quick fix to Remote Console session ID handling. (diff)
downloadopensim-SC-38cfc9366ce264d2aeb6409df48be7cecc348952.zip
opensim-SC-38cfc9366ce264d2aeb6409df48be7cecc348952.tar.gz
opensim-SC-38cfc9366ce264d2aeb6409df48be7cecc348952.tar.bz2
opensim-SC-38cfc9366ce264d2aeb6409df48be7cecc348952.tar.xz
Fix a problem where llDie() calls were sometimes leaving dead objects behind.
When an object was deleted, the remove script instance call was aggregating the scripting events as normal. This would queue a full update of the prim before the viewer was notifed of the deletion of that prim (QuitPacket) On some occasions, the QuitPacket would be sent before the full update was dequeued and sent. In principle, you would think that a viewer would ignore updates for deleted prims. But it appears that in the Linden viewer (1.23.5), a prim update that arrives after the prim was deleted instead makes the deleted prim persist in the viewer. Such prims have no properties and cannot be removed from the viewer except by a relog. This change stops the prim event aggregation call if it's being deleted anyway, hence removing the spurious viewer-confusing update.
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs18
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs21
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs9
8 files changed, 73 insertions, 19 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 4b5e4c4..1d364d4 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1465,6 +1465,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1465 1465
1466 public void SendKillObject(ulong regionHandle, uint localID) 1466 public void SendKillObject(ulong regionHandle, uint localID)
1467 { 1467 {
1468// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle);
1469
1468 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); 1470 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
1469 // TODO: don't create new blocks if recycling an old packet 1471 // TODO: don't create new blocks if recycling an old packet
1470 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 1472 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
@@ -3472,6 +3474,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3472 3474
3473 public void SendPrimitiveToClient(SendPrimitiveData data) 3475 public void SendPrimitiveToClient(SendPrimitiveData data)
3474 { 3476 {
3477// string text = data.text;
3478// if (text.IndexOf("\n") >= 0)
3479// text = text.Remove(text.IndexOf("\n"));
3480// m_log.DebugFormat(
3481// "[CLIENT]: Placing request to send full info about prim {0} text {1} to client {2}",
3482// data.localID, text, Name);
3483
3475 if (data.priority == double.NaN) 3484 if (data.priority == double.NaN)
3476 { 3485 {
3477 m_log.Error("[LLClientView] SendPrimitiveToClient received a NaN priority, dropping update"); 3486 m_log.Error("[LLClientView] SendPrimitiveToClient received a NaN priority, dropping update");
@@ -3509,7 +3518,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3509 3518
3510 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; 3519 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count];
3511 for (int i = 0; i < count; i++) 3520 for (int i = 0; i < count; i++)
3521 {
3512 outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); 3522 outPacket.ObjectData[i] = m_primFullUpdates.Dequeue();
3523
3524// string text = Util.FieldToString(outPacket.ObjectData[i].Text);
3525// if (text.IndexOf("\n") >= 0)
3526// text = text.Remove(text.IndexOf("\n"));
3527// m_log.DebugFormat(
3528// "[CLIENT]: Sending full info about prim {0} text {1} to client {2}",
3529// outPacket.ObjectData[i].ID, text, Name);
3530 }
3513 } 3531 }
3514 3532
3515 OutPacket(outPacket, ThrottleOutPacketType.State); 3533 OutPacket(outPacket, ThrottleOutPacketType.State);
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 67395fa..eeb5102 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -77,7 +77,11 @@ namespace OpenSim.Region.Framework.Interfaces
77 /// <summary> 77 /// <summary>
78 /// Stop all the scripts in this entity. 78 /// Stop all the scripts in this entity.
79 /// </summary> 79 /// </summary>
80 void RemoveScriptInstances(); 80 /// <param name="sceneObjectBeingDeleted">
81 /// Should be true if these scripts are being removed because the scene
82 /// object is being deleted. This will prevent spurious updates to the client.
83 /// </param>
84 void RemoveScriptInstances(bool sceneObjectBeingDeleted);
81 85
82 /// <summary> 86 /// <summary>
83 /// Start a script which is in this entity's inventory. 87 /// Start a script which is in this entity's inventory.
@@ -103,7 +107,11 @@ namespace OpenSim.Region.Framework.Interfaces
103 /// Stop a script which is in this prim's inventory. 107 /// Stop a script which is in this prim's inventory.
104 /// </summary> 108 /// </summary>
105 /// <param name="itemId"></param> 109 /// <param name="itemId"></param>
106 void RemoveScriptInstance(UUID itemId); 110 /// <param name="sceneObjectBeingDeleted">
111 /// Should be true if these scripts are being removed because the scene
112 /// object is being deleted. This will prevent spurious updates to the client.
113 /// </param>
114 void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted);
107 115
108 /// <summary> 116 /// <summary>
109 /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative 117 /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 3044017..11754ea 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -256,7 +256,7 @@ namespace OpenSim.Region.Framework.Scenes
256 256
257 if (isScriptRunning) 257 if (isScriptRunning)
258 { 258 {
259 part.Inventory.RemoveScriptInstance(item.ItemID); 259 part.Inventory.RemoveScriptInstance(item.ItemID, false);
260 } 260 }
261 261
262 // Update item with new asset 262 // Update item with new asset
@@ -855,8 +855,10 @@ namespace OpenSim.Region.Framework.Scenes
855 855
856 if (item.Type == 10) 856 if (item.Type == 10)
857 { 857 {
858 part.RemoveScriptEvents(itemID);
858 EventManager.TriggerRemoveScript(localID, itemID); 859 EventManager.TriggerRemoveScript(localID, itemID);
859 } 860 }
861
860 group.RemoveInventoryItem(localID, itemID); 862 group.RemoveInventoryItem(localID, itemID);
861 part.GetProperties(remoteClient); 863 part.GetProperties(remoteClient);
862 } 864 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 234554e..4da05cf 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1009,7 +1009,7 @@ namespace OpenSim.Region.Framework.Scenes
1009 { 1009 {
1010 if (ent is SceneObjectGroup) 1010 if (ent is SceneObjectGroup)
1011 { 1011 {
1012 ((SceneObjectGroup) ent).RemoveScriptInstances(); 1012 ((SceneObjectGroup) ent).RemoveScriptInstances(false);
1013 } 1013 }
1014 } 1014 }
1015 } 1015 }
@@ -1884,13 +1884,15 @@ namespace OpenSim.Region.Framework.Scenes
1884 /// <param name="silent">Suppress broadcasting changes to other clients.</param> 1884 /// <param name="silent">Suppress broadcasting changes to other clients.</param>
1885 public void DeleteSceneObject(SceneObjectGroup group, bool silent) 1885 public void DeleteSceneObject(SceneObjectGroup group, bool silent)
1886 { 1886 {
1887// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
1888
1887 //SceneObjectPart rootPart = group.GetChildPart(group.UUID); 1889 //SceneObjectPart rootPart = group.GetChildPart(group.UUID);
1888 1890
1889 // Serialise calls to RemoveScriptInstances to avoid 1891 // Serialise calls to RemoveScriptInstances to avoid
1890 // deadlocking on m_parts inside SceneObjectGroup 1892 // deadlocking on m_parts inside SceneObjectGroup
1891 lock (m_deleting_scene_object) 1893 lock (m_deleting_scene_object)
1892 { 1894 {
1893 group.RemoveScriptInstances(); 1895 group.RemoveScriptInstances(true);
1894 } 1896 }
1895 1897
1896 foreach (SceneObjectPart part in group.Children.Values) 1898 foreach (SceneObjectPart part in group.Children.Values)
@@ -1918,6 +1920,8 @@ namespace OpenSim.Region.Framework.Scenes
1918 } 1920 }
1919 1921
1920 group.DeleteGroup(silent); 1922 group.DeleteGroup(silent);
1923
1924// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
1921 } 1925 }
1922 1926
1923 /// <summary> 1927 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 5a06bdb..71354b4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -74,13 +74,17 @@ namespace OpenSim.Region.Framework.Scenes
74 /// <summary> 74 /// <summary>
75 /// Stop the scripts contained in all the prims in this group 75 /// Stop the scripts contained in all the prims in this group
76 /// </summary> 76 /// </summary>
77 public void RemoveScriptInstances() 77 /// <param name="sceneObjectBeingDeleted">
78 /// Should be true if these scripts are being removed because the scene
79 /// object is being deleted. This will prevent spurious updates to the client.
80 /// </param>
81 public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
78 { 82 {
79 lock (m_parts) 83 lock (m_parts)
80 { 84 {
81 foreach (SceneObjectPart part in m_parts.Values) 85 foreach (SceneObjectPart part in m_parts.Values)
82 { 86 {
83 part.Inventory.RemoveScriptInstances(); 87 part.Inventory.RemoveScriptInstances(sceneObjectBeingDeleted);
84 } 88 }
85 } 89 }
86 } 90 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 56b2f13..a5296eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2479,7 +2479,7 @@ namespace OpenSim.Region.Framework.Scenes
2479 //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); 2479 //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString());
2480 //ScheduleFullUpdate(); 2480 //ScheduleFullUpdate();
2481 } 2481 }
2482 2482
2483 public void RemoveScriptEvents(UUID scriptid) 2483 public void RemoveScriptEvents(UUID scriptid)
2484 { 2484 {
2485 lock (m_scriptEvents) 2485 lock (m_scriptEvents)
@@ -2533,6 +2533,8 @@ namespace OpenSim.Region.Framework.Scenes
2533 /// </summary> 2533 /// </summary>
2534 public void ScheduleFullUpdate() 2534 public void ScheduleFullUpdate()
2535 { 2535 {
2536// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId);
2537
2536 if (m_parentGroup != null) 2538 if (m_parentGroup != null)
2537 { 2539 {
2538 m_parentGroup.QueueForUpdateCheck(); 2540 m_parentGroup.QueueForUpdateCheck();
@@ -4042,6 +4044,8 @@ namespace OpenSim.Region.Framework.Scenes
4042 4044
4043 if (m_parentGroup == null) 4045 if (m_parentGroup == null)
4044 { 4046 {
4047// m_log.DebugFormat(
4048// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId);
4045 ScheduleFullUpdate(); 4049 ScheduleFullUpdate();
4046 return; 4050 return;
4047 } 4051 }
@@ -4058,9 +4062,15 @@ namespace OpenSim.Region.Framework.Scenes
4058 LocalFlags=(PrimFlags)objectflagupdate; 4062 LocalFlags=(PrimFlags)objectflagupdate;
4059 4063
4060 if (m_parentGroup != null && m_parentGroup.RootPart == this) 4064 if (m_parentGroup != null && m_parentGroup.RootPart == this)
4065 {
4061 m_parentGroup.aggregateScriptEvents(); 4066 m_parentGroup.aggregateScriptEvents();
4067 }
4062 else 4068 else
4069 {
4070// m_log.DebugFormat(
4071// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
4063 ScheduleFullUpdate(); 4072 ScheduleFullUpdate();
4073 }
4064 } 4074 }
4065 4075
4066 public int registerTargetWaypoint(Vector3 target, float tolerance) 4076 public int registerTargetWaypoint(Vector3 target, float tolerance)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index eb7f5ff..5f13278 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -230,7 +230,11 @@ namespace OpenSim.Region.Framework.Scenes
230 /// <summary> 230 /// <summary>
231 /// Stop all the scripts in this prim. 231 /// Stop all the scripts in this prim.
232 /// </summary> 232 /// </summary>
233 public void RemoveScriptInstances() 233 /// <param name="sceneObjectBeingDeleted">
234 /// Should be true if these scripts are being removed because the scene
235 /// object is being deleted. This will prevent spurious updates to the client.
236 /// </param>
237 public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
234 { 238 {
235 lock (Items) 239 lock (Items)
236 { 240 {
@@ -238,8 +242,7 @@ namespace OpenSim.Region.Framework.Scenes
238 { 242 {
239 if ((int)InventoryType.LSL == item.InvType) 243 if ((int)InventoryType.LSL == item.InvType)
240 { 244 {
241 RemoveScriptInstance(item.ItemID); 245 RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
242 m_part.RemoveScriptEvents(item.ItemID);
243 } 246 }
244 } 247 }
245 } 248 }
@@ -388,10 +391,17 @@ namespace OpenSim.Region.Framework.Scenes
388 /// Stop a script which is in this prim's inventory. 391 /// Stop a script which is in this prim's inventory.
389 /// </summary> 392 /// </summary>
390 /// <param name="itemId"></param> 393 /// <param name="itemId"></param>
391 public void RemoveScriptInstance(UUID itemId) 394 /// <param name="sceneObjectBeingDeleted">
395 /// Should be true if this script is being removed because the scene
396 /// object is being deleted. This will prevent spurious updates to the client.
397 /// </param>
398 public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted)
392 { 399 {
393 if (m_items.ContainsKey(itemId)) 400 if (m_items.ContainsKey(itemId))
394 { 401 {
402 if (!sceneObjectBeingDeleted)
403 m_part.RemoveScriptEvents(itemId);
404
395 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId); 405 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId);
396 m_part.ParentGroup.AddActiveScriptCount(-1); 406 m_part.ParentGroup.AddActiveScriptCount(-1);
397 } 407 }
@@ -465,7 +475,7 @@ namespace OpenSim.Region.Framework.Scenes
465 if (i.Name == item.Name) 475 if (i.Name == item.Name)
466 { 476 {
467 if (i.InvType == (int)InventoryType.LSL) 477 if (i.InvType == (int)InventoryType.LSL)
468 RemoveScriptInstance(i.ItemID); 478 RemoveScriptInstance(i.ItemID, false);
469 479
470 RemoveInventoryItem(i.ItemID); 480 RemoveInventoryItem(i.ItemID);
471 break; 481 break;
@@ -613,6 +623,7 @@ namespace OpenSim.Region.Framework.Scenes
613 int type = m_items[itemID].InvType; 623 int type = m_items[itemID].InvType;
614 if (type == 10) // Script 624 if (type == 10) // Script
615 { 625 {
626 m_part.RemoveScriptEvents(itemID);
616 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); 627 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
617 } 628 }
618 m_items.Remove(itemID); 629 m_items.Remove(itemID);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 6dd94bb..c552b92 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -806,12 +806,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
806 instance.ClearQueue(); 806 instance.ClearQueue();
807 instance.Stop(0); 807 instance.Stop(0);
808 808
809 SceneObjectPart part =
810 m_Scene.GetSceneObjectPart(localID);
811
812 if (part != null)
813 part.RemoveScriptEvents(itemID);
814
815// bool objectRemoved = false; 809// bool objectRemoved = false;
816 810
817 lock (m_PrimObjects) 811 lock (m_PrimObjects)
@@ -846,7 +840,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
846 840
847 ObjectRemoved handlerObjectRemoved = OnObjectRemoved; 841 ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
848 if (handlerObjectRemoved != null) 842 if (handlerObjectRemoved != null)
843 {
844 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
849 handlerObjectRemoved(part.UUID); 845 handlerObjectRemoved(part.UUID);
846 }
850 847
851 CleanAssemblies(); 848 CleanAssemblies();
852 } 849 }