mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 11:57:03 +08:00
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
This commit is contained in:
@@ -4272,10 +4272,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
|
||||
}
|
||||
|
||||
// Subscribe for physics collision events if needed for scripts and sounds
|
||||
/// <summary>
|
||||
/// Subscribe for physics collision events if needed for scripts and sounds
|
||||
/// </summary>
|
||||
public void SubscribeForCollisionEvents()
|
||||
{
|
||||
if (PhysActor != null)
|
||||
PhysicsActor pa = PhysActor;
|
||||
|
||||
if (pa != null)
|
||||
{
|
||||
if (
|
||||
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
||||
@@ -4293,20 +4297,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
(CollisionSound != UUID.Zero)
|
||||
)
|
||||
{
|
||||
if (!PhysActor.SubscribedEvents())
|
||||
if (!pa.SubscribedEvents())
|
||||
{
|
||||
// If not already subscribed for event, set up for a collision event.
|
||||
PhysActor.OnCollisionUpdate += PhysicsCollision;
|
||||
PhysActor.SubscribeEvents(1000);
|
||||
pa.OnCollisionUpdate += PhysicsCollision;
|
||||
pa.SubscribeEvents(1000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// There is no need to be subscribed to collisions so, if subscribed, remove subscription
|
||||
if (PhysActor.SubscribedEvents())
|
||||
if (pa.SubscribedEvents())
|
||||
{
|
||||
PhysActor.OnCollisionUpdate -= PhysicsCollision;
|
||||
PhysActor.UnSubscribeEvents();
|
||||
pa.OnCollisionUpdate -= PhysicsCollision;
|
||||
pa.UnSubscribeEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
|
||||
{
|
||||
m_coopTermination = true;
|
||||
m_coopSleepHandle = new AutoResetEvent(false);
|
||||
m_coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1201,4 +1201,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
Suspended = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Xengine event wait handle.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class exists becase XEngineScriptBase gets a reference to this wait handle. We need to make sure that
|
||||
/// when scripts are running in different AppDomains the lease does not expire.
|
||||
/// FIXME: Like LSL_Api, etc., this effectively leaks memory since the GC will never collect it. To avoid this,
|
||||
/// proper remoting sponsorship needs to be implemented across the board.
|
||||
/// </remarks>
|
||||
public class XEngineEventWaitHandle : EventWaitHandle
|
||||
{
|
||||
public XEngineEventWaitHandle(bool initialState, EventResetMode mode) : base(initialState, mode) {}
|
||||
|
||||
public override Object InitializeLifetimeService()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user