diff options
author | UbitUmarov | 2013-01-02 20:06:57 +0000 |
---|---|---|
committer | UbitUmarov | 2013-01-02 20:06:57 +0000 |
commit | be6b6bf191718f7c674297a804fa1a6cb4196a5a (patch) | |
tree | 6279df1522ab7bff4d06e721347427149af15e95 /OpenSim/Region | |
parent | *TEST* avatar unscripted sit. Some guessing/automation (diff) | |
download | opensim-SC_OLD-be6b6bf191718f7c674297a804fa1a6cb4196a5a.zip opensim-SC_OLD-be6b6bf191718f7c674297a804fa1a6cb4196a5a.tar.gz opensim-SC_OLD-be6b6bf191718f7c674297a804fa1a6cb4196a5a.tar.bz2 opensim-SC_OLD-be6b6bf191718f7c674297a804fa1a6cb4196a5a.tar.xz |
add a lock to CollisionEventsThisFrame
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index e1d694e..f7e4c1c 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |||
@@ -1540,8 +1540,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1540 | { | 1540 | { |
1541 | if (CollisionEventsThisFrame != null) | 1541 | if (CollisionEventsThisFrame != null) |
1542 | { | 1542 | { |
1543 | CollisionEventsThisFrame.Clear(); | 1543 | lock (CollisionEventsThisFrame) |
1544 | CollisionEventsThisFrame = null; | 1544 | { |
1545 | CollisionEventsThisFrame.Clear(); | ||
1546 | CollisionEventsThisFrame = null; | ||
1547 | } | ||
1545 | } | 1548 | } |
1546 | m_eventsubscription = 0; | 1549 | m_eventsubscription = 0; |
1547 | } | 1550 | } |
@@ -1550,8 +1553,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1550 | { | 1553 | { |
1551 | if (CollisionEventsThisFrame == null) | 1554 | if (CollisionEventsThisFrame == null) |
1552 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 1555 | CollisionEventsThisFrame = new CollisionEventUpdate(); |
1553 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | 1556 | lock (CollisionEventsThisFrame) |
1554 | _parent_scene.AddCollisionEventReporting(this); | 1557 | { |
1558 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | ||
1559 | _parent_scene.AddCollisionEventReporting(this); | ||
1560 | } | ||
1555 | } | 1561 | } |
1556 | 1562 | ||
1557 | public void SendCollisions() | 1563 | public void SendCollisions() |
@@ -1559,26 +1565,29 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1559 | if (CollisionEventsThisFrame == null) | 1565 | if (CollisionEventsThisFrame == null) |
1560 | return; | 1566 | return; |
1561 | 1567 | ||
1562 | if (m_cureventsubscription < m_eventsubscription) | 1568 | lock (CollisionEventsThisFrame) |
1563 | return; | 1569 | { |
1570 | if (m_cureventsubscription < m_eventsubscription) | ||
1571 | return; | ||
1564 | 1572 | ||
1565 | m_cureventsubscription = 0; | 1573 | m_cureventsubscription = 0; |
1566 | 1574 | ||
1567 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; | 1575 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; |
1568 | 1576 | ||
1569 | if (!SentEmptyCollisionsEvent || ncolisions > 0) | 1577 | if (!SentEmptyCollisionsEvent || ncolisions > 0) |
1570 | { | ||
1571 | base.SendCollisionUpdate(CollisionEventsThisFrame); | ||
1572 | |||
1573 | if (ncolisions == 0) | ||
1574 | { | 1578 | { |
1575 | SentEmptyCollisionsEvent = true; | 1579 | base.SendCollisionUpdate(CollisionEventsThisFrame); |
1576 | _parent_scene.RemoveCollisionEventReporting(this); | 1580 | |
1577 | } | 1581 | if (ncolisions == 0) |
1578 | else | 1582 | { |
1579 | { | 1583 | SentEmptyCollisionsEvent = true; |
1580 | SentEmptyCollisionsEvent = false; | 1584 | _parent_scene.RemoveCollisionEventReporting(this); |
1581 | CollisionEventsThisFrame.Clear(); | 1585 | } |
1586 | else | ||
1587 | { | ||
1588 | SentEmptyCollisionsEvent = false; | ||
1589 | CollisionEventsThisFrame.Clear(); | ||
1590 | } | ||
1582 | } | 1591 | } |
1583 | } | 1592 | } |
1584 | } | 1593 | } |