Don't eagerly clear frame collision events when physics actors subscribe and unsubscribe from collisions, in order to avoid a race condition.

Since this is done directly from ScenePresence, it can lead to a race condition with the simulator loop.
There's no real point doing it anyway since the clear will be done very shortly afterwards by the simulate loop and either there are no events (for a new avatar) or events don't matter (for a departing avatar).
This matches existing behaviour in OdePrim
0.7.4.1
Justin Clark-Casey (justincc) 2012-05-17 23:59:43 +01:00
parent 521ad080f1
commit b18c8c8e78
1 changed files with 8 additions and 2 deletions

View File

@ -1261,14 +1261,20 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
m_requestedUpdateFrequency = ms; m_requestedUpdateFrequency = ms;
m_eventsubscription = ms; m_eventsubscription = ms;
CollisionEventsThisFrame.Clear();
// Don't clear collision event reporting here. This is called directly from scene code and so can lead
// to a race condition with the simulate loop
_parent_scene.AddCollisionEventReporting(this); _parent_scene.AddCollisionEventReporting(this);
} }
public override void UnSubscribeEvents() public override void UnSubscribeEvents()
{ {
CollisionEventsThisFrame.Clear(); CollisionEventsThisFrame.Clear();
_parent_scene.RemoveCollisionEventReporting(this);
// Don't clear collision event reporting here. This is called directly from scene code and so can lead
// to a race condition with the simulate loop
m_requestedUpdateFrequency = 0; m_requestedUpdateFrequency = 0;
m_eventsubscription = 0; m_eventsubscription = 0;
} }