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.
This commit is contained in:
Justin Clark-Casey (justincc)
2010-01-25 21:51:58 +00:00
parent 19d4867af7
commit 38cfc9366c
8 changed files with 73 additions and 19 deletions

View File

@@ -230,7 +230,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Stop all the scripts in this prim.
/// </summary>
public void RemoveScriptInstances()
/// <param name="sceneObjectBeingDeleted">
/// Should be true if these scripts are being removed because the scene
/// object is being deleted. This will prevent spurious updates to the client.
/// </param>
public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
{
lock (Items)
{
@@ -238,8 +242,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if ((int)InventoryType.LSL == item.InvType)
{
RemoveScriptInstance(item.ItemID);
m_part.RemoveScriptEvents(item.ItemID);
RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
}
}
}
@@ -388,10 +391,17 @@ namespace OpenSim.Region.Framework.Scenes
/// Stop a script which is in this prim's inventory.
/// </summary>
/// <param name="itemId"></param>
public void RemoveScriptInstance(UUID itemId)
/// <param name="sceneObjectBeingDeleted">
/// Should be true if this script is being removed because the scene
/// object is being deleted. This will prevent spurious updates to the client.
/// </param>
public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted)
{
if (m_items.ContainsKey(itemId))
{
if (!sceneObjectBeingDeleted)
m_part.RemoveScriptEvents(itemId);
m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId);
m_part.ParentGroup.AddActiveScriptCount(-1);
}
@@ -465,7 +475,7 @@ namespace OpenSim.Region.Framework.Scenes
if (i.Name == item.Name)
{
if (i.InvType == (int)InventoryType.LSL)
RemoveScriptInstance(i.ItemID);
RemoveScriptInstance(i.ItemID, false);
RemoveInventoryItem(i.ItemID);
break;
@@ -613,6 +623,7 @@ namespace OpenSim.Region.Framework.Scenes
int type = m_items[itemID].InvType;
if (type == 10) // Script
{
m_part.RemoveScriptEvents(itemID);
m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
}
m_items.Remove(itemID);