diff options
author | Robert Adams | 2012-07-26 16:03:15 -0700 |
---|---|---|
committer | Robert Adams | 2012-07-26 16:03:15 -0700 |
commit | 9e914f5c321d5588b196221343e3bc9ed9735f64 (patch) | |
tree | fc0e36848ea61ae4a37e4d6c76324fbe621e10f7 /OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |
parent | Add a Dispose() of the physics engine when a scene is being shutdown. (diff) | |
download | opensim-SC-9e914f5c321d5588b196221343e3bc9ed9735f64.zip opensim-SC-9e914f5c321d5588b196221343e3bc9ed9735f64.tar.gz opensim-SC-9e914f5c321d5588b196221343e3bc9ed9735f64.tar.bz2 opensim-SC-9e914f5c321d5588b196221343e3bc9ed9735f64.tar.xz |
Add check so Ode does not try to simulate after it has been Dispose()'ed. Fixes exception that happens when shutting down region (improvements from last patch)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 32e81e2..0db936f 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -489,6 +489,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
489 | /// </summary> | 489 | /// </summary> |
490 | internal Object OdeLock = new Object(); | 490 | internal Object OdeLock = new Object(); |
491 | 491 | ||
492 | private bool _worldInitialized = false; | ||
493 | |||
492 | public IMesher mesher; | 494 | public IMesher mesher; |
493 | 495 | ||
494 | private IConfigSource m_config; | 496 | private IConfigSource m_config; |
@@ -875,6 +877,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
875 | staticPrimspace[i, j] = IntPtr.Zero; | 877 | staticPrimspace[i, j] = IntPtr.Zero; |
876 | } | 878 | } |
877 | } | 879 | } |
880 | |||
881 | _worldInitialized = true; | ||
878 | } | 882 | } |
879 | 883 | ||
880 | // internal void waitForSpaceUnlock(IntPtr space) | 884 | // internal void waitForSpaceUnlock(IntPtr space) |
@@ -2896,6 +2900,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2896 | /// <returns>The number of frames simulated over that period.</returns> | 2900 | /// <returns>The number of frames simulated over that period.</returns> |
2897 | public override float Simulate(float timeStep) | 2901 | public override float Simulate(float timeStep) |
2898 | { | 2902 | { |
2903 | if (!_worldInitialized) return 11f; | ||
2904 | |||
2899 | int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; | 2905 | int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; |
2900 | int tempTick = 0, tempTick2 = 0; | 2906 | int tempTick = 0, tempTick2 = 0; |
2901 | 2907 | ||
@@ -4017,6 +4023,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
4017 | 4023 | ||
4018 | public override void Dispose() | 4024 | public override void Dispose() |
4019 | { | 4025 | { |
4026 | _worldInitialized = false; | ||
4027 | |||
4020 | m_rayCastManager.Dispose(); | 4028 | m_rayCastManager.Dispose(); |
4021 | m_rayCastManager = null; | 4029 | m_rayCastManager = null; |
4022 | 4030 | ||
@@ -4037,6 +4045,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
4037 | d.WorldDestroy(world); | 4045 | d.WorldDestroy(world); |
4038 | //d.CloseODE(); | 4046 | //d.CloseODE(); |
4039 | } | 4047 | } |
4048 | |||
4040 | } | 4049 | } |
4041 | 4050 | ||
4042 | public override Dictionary<uint, float> GetTopColliders() | 4051 | public override Dictionary<uint, float> GetTopColliders() |