put a lock back in ubOde character :(

LSLKeyTest
UbitUmarov 2016-09-12 18:10:11 +01:00
parent b9380c033d
commit 34dce801b2
1 changed files with 22 additions and 29 deletions

View File

@ -112,7 +112,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private bool _zeroFlag = false; private bool _zeroFlag = false;
private bool m_haveLastFallVel = false; private bool m_haveLastFallVel = false;
private uint m_localID = 0; private uint m_localID = 0;
public bool m_returnCollisions = false; public bool m_returnCollisions = false;
// taints and their non-tainted counterparts // taints and their non-tainted counterparts
@ -149,7 +148,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public int m_eventsubscription = 0; public int m_eventsubscription = 0;
private int m_cureventsubscription = 0; private int m_cureventsubscription = 0;
private CollisionEventUpdate CollisionEventsThisFrame = null; private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
private bool SentEmptyCollisionsEvent; private bool SentEmptyCollisionsEvent;
// unique UUID of this character object // unique UUID of this character object
@ -1556,31 +1555,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public override float APIDDamping { set { return; } } public override float APIDDamping { set { return; } }
public override void SubscribeEvents(int ms) public override void SubscribeEvents(int ms)
{ {
m_eventsubscription = ms; m_eventsubscription = ms;
m_cureventsubscription = 0; m_cureventsubscription = 0;
if (CollisionEventsThisFrame == null) CollisionEventsThisFrame.Clear();
CollisionEventsThisFrame = new CollisionEventUpdate();
SentEmptyCollisionsEvent = false; SentEmptyCollisionsEvent = false;
} }
public override void UnSubscribeEvents() public override void UnSubscribeEvents()
{ {
if (CollisionEventsThisFrame != null)
{
CollisionEventsThisFrame.Clear();
CollisionEventsThisFrame = null;
}
m_eventsubscription = 0; m_eventsubscription = 0;
_parent_scene.RemoveCollisionEventReporting(this); _parent_scene.RemoveCollisionEventReporting(this);
lock(CollisionEventsThisFrame)
CollisionEventsThisFrame.Clear();
} }
public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
{ {
if (CollisionEventsThisFrame == null) lock(CollisionEventsThisFrame)
CollisionEventsThisFrame = new CollisionEventUpdate();
CollisionEventsThisFrame.AddCollider(CollidedWith, contact); CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
_parent_scene.AddCollisionEventReporting(this); _parent_scene.AddCollisionEventReporting(this);
} }
@ -1590,12 +1583,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (m_cureventsubscription < 50000) if (m_cureventsubscription < 50000)
m_cureventsubscription += timestep; m_cureventsubscription += timestep;
if (CollisionEventsThisFrame == null)
return;
if (m_cureventsubscription < m_eventsubscription) if (m_cureventsubscription < m_eventsubscription)
return; return;
lock(CollisionEventsThisFrame)
{
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
if (!SentEmptyCollisionsEvent || ncolisions > 0) if (!SentEmptyCollisionsEvent || ncolisions > 0)
@ -1606,7 +1598,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (ncolisions == 0) if (ncolisions == 0)
{ {
SentEmptyCollisionsEvent = true; SentEmptyCollisionsEvent = true;
// _parent_scene.RemoveCollisionEventReporting(this); // _parent_scene.RemoveCollisionEventReporting(this);
} }
else else
{ {
@ -1615,6 +1607,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
} }
} }
} }
}
public override bool SubscribedEvents() public override bool SubscribedEvents()
{ {