aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs23
2 files changed, 33 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 830fe31..eb3af42 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4272,10 +4272,14 @@ namespace OpenSim.Region.Framework.Scenes
4272// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); 4272// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
4273 } 4273 }
4274 4274
4275 // Subscribe for physics collision events if needed for scripts and sounds 4275 /// <summary>
4276 /// Subscribe for physics collision events if needed for scripts and sounds
4277 /// </summary>
4276 public void SubscribeForCollisionEvents() 4278 public void SubscribeForCollisionEvents()
4277 { 4279 {
4278 if (PhysActor != null) 4280 PhysicsActor pa = PhysActor;
4281
4282 if (pa != null)
4279 { 4283 {
4280 if ( 4284 if (
4281 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4285 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
@@ -4293,20 +4297,20 @@ namespace OpenSim.Region.Framework.Scenes
4293 (CollisionSound != UUID.Zero) 4297 (CollisionSound != UUID.Zero)
4294 ) 4298 )
4295 { 4299 {
4296 if (!PhysActor.SubscribedEvents()) 4300 if (!pa.SubscribedEvents())
4297 { 4301 {
4298 // If not already subscribed for event, set up for a collision event. 4302 // If not already subscribed for event, set up for a collision event.
4299 PhysActor.OnCollisionUpdate += PhysicsCollision; 4303 pa.OnCollisionUpdate += PhysicsCollision;
4300 PhysActor.SubscribeEvents(1000); 4304 pa.SubscribeEvents(1000);
4301 } 4305 }
4302 } 4306 }
4303 else 4307 else
4304 { 4308 {
4305 // There is no need to be subscribed to collisions so, if subscribed, remove subscription 4309 // There is no need to be subscribed to collisions so, if subscribed, remove subscription
4306 if (PhysActor.SubscribedEvents()) 4310 if (pa.SubscribedEvents())
4307 { 4311 {
4308 PhysActor.OnCollisionUpdate -= PhysicsCollision; 4312 pa.OnCollisionUpdate -= PhysicsCollision;
4309 PhysActor.UnSubscribeEvents(); 4313 pa.UnSubscribeEvents();
4310 } 4314 }
4311 } 4315 }
4312 } 4316 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 887a317..229180f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -241,7 +241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
241 if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op") 241 if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
242 { 242 {
243 m_coopTermination = true; 243 m_coopTermination = true;
244 m_coopSleepHandle = new AutoResetEvent(false); 244 m_coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
245 } 245 }
246 } 246 }
247 247
@@ -1201,4 +1201,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1201 Suspended = false; 1201 Suspended = false;
1202 } 1202 }
1203 } 1203 }
1204} 1204
1205 /// <summary>
1206 /// Xengine event wait handle.
1207 /// </summary>
1208 /// <remarks>
1209 /// This class exists becase XEngineScriptBase gets a reference to this wait handle. We need to make sure that
1210 /// when scripts are running in different AppDomains the lease does not expire.
1211 /// FIXME: Like LSL_Api, etc., this effectively leaks memory since the GC will never collect it. To avoid this,
1212 /// proper remoting sponsorship needs to be implemented across the board.
1213 /// </remarks>
1214 public class XEngineEventWaitHandle : EventWaitHandle
1215 {
1216 public XEngineEventWaitHandle(bool initialState, EventResetMode mode) : base(initialState, mode) {}
1217
1218 public override Object InitializeLifetimeService()
1219 {
1220 return null;
1221 }
1222 }
1223} \ No newline at end of file