From 65a8ac810eea6bd6e9478ced7f2e1ae068b16552 Mon Sep 17 00:00:00 2001 From: Jim Radford Date: Wed, 12 Mar 2008 19:07:41 +0000 Subject: [PATCH] applies patch from DrScofield from Mantis#161 - moves object kill notification before actual kill. git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1664 52acb1d6-8a22-11de-b505-999d5b087335 --- libsecondlife/ObjectManager.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libsecondlife/ObjectManager.cs b/libsecondlife/ObjectManager.cs index f78c794c..4eb709c2 100644 --- a/libsecondlife/ObjectManager.cs +++ b/libsecondlife/ObjectManager.cs @@ -343,7 +343,7 @@ namespace libsecondlife public delegate void NewFoliageCallback(Simulator simulator, Primitive foliage, ulong regionHandle, ushort timeDilation); /// - /// + /// Called whenever an object disappears /// /// /// @@ -2071,6 +2071,11 @@ namespace libsecondlife { KillObjectPacket kill = (KillObjectPacket)packet; + // Notify first, so that handler has a chance to get a + // reference from the ObjectTracker to the object being killed + for (int i = 0; i < kill.ObjectData.Length; i++) + FireOnObjectKilled(simulator, kill.ObjectData[i].ID); + // Run the for loop multiple times so we only have to lock a total // of two times. Locking is by far the most expensive operation here @@ -2100,9 +2105,6 @@ namespace libsecondlife } } } - - for (int i = 0; i < kill.ObjectData.Length; i++) - FireOnObjectKilled(simulator, kill.ObjectData[i].ID); } protected void ObjectPropertiesHandler(Packet p, Simulator sim)