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)