aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2012-08-14 16:38:11 -0700
committerRobert Adams2012-08-15 12:08:05 -0700
commit257446889b5fecf9a5e085f8e3b963dca3613e3f (patch)
tree7bf7074ba771b5df1c00a71ec3ad88a40d446181
parentBulletSim: Refactor BSConstraintCollection to add a new RemoveAndDestroyConst... (diff)
downloadopensim-SC-257446889b5fecf9a5e085f8e3b963dca3613e3f.zip
opensim-SC-257446889b5fecf9a5e085f8e3b963dca3613e3f.tar.gz
opensim-SC-257446889b5fecf9a5e085f8e3b963dca3613e3f.tar.bz2
opensim-SC-257446889b5fecf9a5e085f8e3b963dca3613e3f.tar.xz
BulletSim: fix problem of a null reference exception on shutdown if there were linksets in the region.
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs25
1 files changed, 13 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index f63ad95..cacab01 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -511,12 +511,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters
511 // long simulateTotalTime = Util.EnvironmentTickCountSubtract(simulateStartTime); 511 // long simulateTotalTime = Util.EnvironmentTickCountSubtract(simulateStartTime);
512 // return (timeStep * (float)simulateTotalTime); 512 // return (timeStep * (float)simulateTotalTime);
513 513
514 // TODO: FIX THIS: fps calculation possibly wrong. 514 // TODO: FIX THIS: fps calculation possibly wrong.
515 // This calculation says 1/timeStep is the ideal frame rate. Any time added to 515 // This calculation says 1/timeStep is the ideal frame rate. Any time added to
516 // that by the physics simulation gives a slower frame rate. 516 // that by the physics simulation gives a slower frame rate.
517 long totalSimulationTime = Util.EnvironmentTickCountSubtract(simulateStartTime); 517 long totalSimulationTime = Util.EnvironmentTickCountSubtract(simulateStartTime);
518 if (totalSimulationTime >= timeStep) 518 if (totalSimulationTime >= timeStep)
519 return 0; 519 return 0;
520 return 1f / (timeStep + totalSimulationTime); 520 return 1f / (timeStep + totalSimulationTime);
521 } 521 }
522 522
@@ -595,12 +595,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters
595 // make sure no stepping happens while we're deleting stuff 595 // make sure no stepping happens while we're deleting stuff
596 m_initialized = false; 596 m_initialized = false;
597 597
598 if (m_constraintCollection != null)
599 {
600 m_constraintCollection.Dispose();
601 m_constraintCollection = null;
602 }
603
604 foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars) 598 foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars)
605 { 599 {
606 kvp.Value.Destroy(); 600 kvp.Value.Destroy();
@@ -613,6 +607,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
613 } 607 }
614 m_prims.Clear(); 608 m_prims.Clear();
615 609
610 // Now that the prims are all cleaned up, there should be no constraints left
611 if (m_constraintCollection != null)
612 {
613 m_constraintCollection.Dispose();
614 m_constraintCollection = null;
615 }
616
616 // Anything left in the unmanaged code should be cleaned out 617 // Anything left in the unmanaged code should be cleaned out
617 BulletSimAPI.Shutdown(WorldID); 618 BulletSimAPI.Shutdown(WorldID);
618 619