diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f7bbc513f8..9a659dcc45 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3011,13 +3011,14 @@ namespace OpenSim.Region.Framework.Scenes public void RemoveScriptEvents(UUID scriptid) { + + if (ParentGroup != null) + ParentGroup.RemoveScriptTargets(scriptid); + lock (m_scriptEvents) { if (m_scriptEvents.TryGetValue(scriptid, out scriptEvents ev)) { - if (((ev & (scriptEvents.at_target | scriptEvents.at_rot_target)) != 0) && ParentGroup != null) - ParentGroup.RemoveScriptTargets(scriptid); - m_scriptEvents.Remove(scriptid); aggregateScriptEvents(); } @@ -4000,12 +4001,14 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT PART]: Set script events for script with id {0} on {1}/{2} to {3} in {4}", // scriptid, Name, ParentGroup.Name, events, ParentGroup.Scene.Name); // scriptEvents oldparts; + + if (ParentGroup != null) + ParentGroup.RemoveScriptTargets(scriptid); + lock (m_scriptEvents) { if (m_scriptEvents.TryGetValue(scriptid, out scriptEvents ev)) { - if (((ev & (scriptEvents.at_target | scriptEvents.at_rot_target)) != 0) && ParentGroup != null) - ParentGroup.RemoveScriptTargets(scriptid); if (ev == (scriptEvents)events) return; }