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.
0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-10-25 21:38:02 +01:00
parent d4fc07aae1
commit 057b78bfbe
1 changed files with 5 additions and 4 deletions

View File

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