aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
diff options
context:
space:
mode:
authorRobert Adams2013-01-14 15:46:46 -0800
committerRobert Adams2013-01-14 15:46:46 -0800
commit4e1ca890c2d41bf244ed7d4847c0d0a4fc7f6c51 (patch)
treebef4e616c6fb6a3de0e6859b6ef3e664095c2ae6 /OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
parentBulletSim: disable center-of-mass computation for linksets until debugged. Mo... (diff)
downloadopensim-SC-4e1ca890c2d41bf244ed7d4847c0d0a4fc7f6c51.zip
opensim-SC-4e1ca890c2d41bf244ed7d4847c0d0a4fc7f6c51.tar.gz
opensim-SC-4e1ca890c2d41bf244ed7d4847c0d0a4fc7f6c51.tar.bz2
opensim-SC-4e1ca890c2d41bf244ed7d4847c0d0a4fc7f6c51.tar.xz
BulletSim: fix not moving physical objects below terrain to over terrain.
Add locking on register prestep action list preventing potential race conditions. Little comment and formatting changes.
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs29
1 files changed, 19 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 185f111..821f470 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -382,10 +382,13 @@ public abstract class BSPhysObject : PhysicsActor
382 { 382 {
383 string identifier = op + "-" + id.ToString(); 383 string identifier = op + "-" + id.ToString();
384 384
385 // Clean out any existing action 385 lock (RegisteredActions)
386 UnRegisterPreStepAction(op, id); 386 {
387 // Clean out any existing action
388 UnRegisterPreStepAction(op, id);
387 389
388 RegisteredActions[identifier] = actn; 390 RegisteredActions[identifier] = actn;
391 }
389 PhysicsScene.BeforeStep += actn; 392 PhysicsScene.BeforeStep += actn;
390 DetailLog("{0},BSPhysObject.RegisterPreStepAction,id={1}", LocalID, identifier); 393 DetailLog("{0},BSPhysObject.RegisterPreStepAction,id={1}", LocalID, identifier);
391 } 394 }
@@ -395,22 +398,28 @@ public abstract class BSPhysObject : PhysicsActor
395 { 398 {
396 string identifier = op + "-" + id.ToString(); 399 string identifier = op + "-" + id.ToString();
397 bool removed = false; 400 bool removed = false;
398 if (RegisteredActions.ContainsKey(identifier)) 401 lock (RegisteredActions)
399 { 402 {
400 PhysicsScene.BeforeStep -= RegisteredActions[identifier]; 403 if (RegisteredActions.ContainsKey(identifier))
401 RegisteredActions.Remove(identifier); 404 {
402 removed = true; 405 PhysicsScene.BeforeStep -= RegisteredActions[identifier];
406 RegisteredActions.Remove(identifier);
407 removed = true;
408 }
403 } 409 }
404 DetailLog("{0},BSPhysObject.UnRegisterPreStepAction,id={1},removed={2}", LocalID, identifier, removed); 410 DetailLog("{0},BSPhysObject.UnRegisterPreStepAction,id={1},removed={2}", LocalID, identifier, removed);
405 } 411 }
406 412
407 protected void UnRegisterAllPreStepActions() 413 protected void UnRegisterAllPreStepActions()
408 { 414 {
409 foreach (KeyValuePair<string, BSScene.PreStepAction> kvp in RegisteredActions) 415 lock (RegisteredActions)
410 { 416 {
411 PhysicsScene.BeforeStep -= kvp.Value; 417 foreach (KeyValuePair<string, BSScene.PreStepAction> kvp in RegisteredActions)
418 {
419 PhysicsScene.BeforeStep -= kvp.Value;
420 }
421 RegisteredActions.Clear();
412 } 422 }
413 RegisteredActions.Clear();
414 DetailLog("{0},BSPhysObject.UnRegisterAllPreStepActions,", LocalID); 423 DetailLog("{0},BSPhysObject.UnRegisterAllPreStepActions,", LocalID);
415 } 424 }
416 425