From f3b1efd889e2e87f89c8e8da6a08089596c878f6 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 15 Dec 2012 11:31:26 -0800 Subject: BulletSim: remove some errors on shutdown by moving terrain destruction until after physical object destruction. TerrainManager also made disposable and that feature used. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 9 +++++++-- OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | 10 +++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index cf5bb57..ac99777 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -349,8 +349,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters // make sure no stepping happens while we're deleting stuff m_initialized = false; - TerrainManager.ReleaseGroundPlaneAndTerrain(); - foreach (KeyValuePair kvp in PhysObjects) { kvp.Value.Destroy(); @@ -370,6 +368,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters Shapes = null; } + if (TerrainManager != null) + { + TerrainManager.ReleaseGroundPlaneAndTerrain(); + TerrainManager.Dispose(); + TerrainManager = null; + } + // Anything left in the unmanaged code should be cleaned out BulletSimAPI.Shutdown2(World.ptr); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index 5dbd8ce..c68fd69 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs @@ -67,7 +67,7 @@ public abstract class BSTerrainPhys : IDisposable } // ========================================================================================== -public sealed class BSTerrainManager +public sealed class BSTerrainManager : IDisposable { static string LogHeader = "[BULLETSIM TERRAIN MANAGER]"; @@ -122,6 +122,11 @@ public sealed class BSTerrainManager MegaRegionParentPhysicsScene = null; } + public void Dispose() + { + ReleaseGroundPlaneAndTerrain(); + } + // Create the initial instance of terrain and the underlying ground plane. // This is called from the initialization routine so we presume it is // safe to call Bullet in real time. We hope no one is moving prims around yet. @@ -366,6 +371,9 @@ public sealed class BSTerrainManager { PhysicsScene.Logger.ErrorFormat("{0} GetTerrainHeightAtXY: terrain not found: region={1}, x={2}, y={3}", LogHeader, PhysicsScene.RegionName, tX, tY); + DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXYZ,terrainNotFound,loc={1},base={2}", + BSScene.DetailLogZero, loc, terrainBaseXYZ); + Util.PrintCallStack(); // DEBUG DEBUG DEBUG } } lastHeight = ret; -- cgit v1.1