Fix bug where collision event listeners were not removed once the listener had gone away.

This was causing continuous use of temporary memory even when all avatars had left the scene.
Memory does leak but it does cause more calls to the garbage collector, which would pause the scene thread for a very short while during collection.
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-10-25 21:38:02 +01:00
parent 1fbb379536
commit 7b6b36cee9
1 changed files with 5 additions and 4 deletions

View File

@ -1633,6 +1633,8 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <param name="obj"></param>
internal void AddCollisionEventReporting(PhysicsActor obj)
{
// m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName);
lock (_collisionEventPrim)
{
if (!_collisionEventPrim.Contains(obj))
@ -1646,11 +1648,10 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <param name="obj"></param>
internal void RemoveCollisionEventReporting(PhysicsActor obj)
{
// m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName);
lock (_collisionEventPrim)
{
if (!_collisionEventPrim.Contains(obj))
_collisionEventPrim.Remove(obj);
}
_collisionEventPrim.Remove(obj);
}
#region Add/Remove Entities