aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorRobert Adams2014-01-28 08:50:28 -0800
committerRobert Adams2014-01-28 08:50:28 -0800
commit8eec717f5f0f34354a73dcfeecdd3e9514d5e435 (patch)
treefec59ef61f8782d21641a3a16080493d20a420b1 /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentvarregion: fix for teleporting by double clicking on a map location. (diff)
parentMerge branch 'justincc-master' (diff)
downloadopensim-SC_OLD-8eec717f5f0f34354a73dcfeecdd3e9514d5e435.zip
opensim-SC_OLD-8eec717f5f0f34354a73dcfeecdd3e9514d5e435.tar.gz
opensim-SC_OLD-8eec717f5f0f34354a73dcfeecdd3e9514d5e435.tar.bz2
opensim-SC_OLD-8eec717f5f0f34354a73dcfeecdd3e9514d5e435.tar.xz
Merge branch 'master' into varregion
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs47
1 files changed, 31 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b4274ba..715a9b6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1193,22 +1193,36 @@ namespace OpenSim.Region.Framework.Scenes
1193 // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently 1193 // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently
1194 // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are 1194 // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are
1195 // not transporting the required data. 1195 // not transporting the required data.
1196 lock (m_attachments) 1196 //
1197 // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT
1198 // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently
1199 // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are
1200 // not transporting the required data.
1201 //
1202 // We must take a copy of the attachments list here (rather than locking) to avoid a deadlock where a script in one of
1203 // the attachments may start processing an event (which locks ScriptInstance.m_Script) that then calls a method here
1204 // which needs to lock m_attachments. ResumeScripts() needs to take a ScriptInstance.m_Script lock to try to unset the Suspend status.
1205 //
1206 // FIXME: In theory, this deadlock should not arise since scripts should not be processing events until ResumeScripts().
1207 // But XEngine starts all scripts unsuspended. Starting them suspended will not currently work because script rezzing
1208 // is placed in an asynchronous queue in XEngine and so the ResumeScripts() call will almost certainly execute before the
1209 // script is rezzed. This means the ResumeScripts() does absolutely nothing when using XEngine.
1210 //
1211 // One cannot simply iterate over attachments in a fire and forget thread because this would no longer
1212 // be locked, allowing race conditions if other code changes the attachments list.
1213 List<SceneObjectGroup> attachments = GetAttachments();
1214
1215 if (attachments.Count > 0)
1197 { 1216 {
1198 if (HasAttachments()) 1217 m_log.DebugFormat(
1199 { 1218 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
1200 m_log.DebugFormat(
1201 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
1202 1219
1203 // Resume scripts 1220 // Resume scripts
1204 Util.FireAndForget(delegate(object x) { 1221 foreach (SceneObjectGroup sog in attachments)
1205 foreach (SceneObjectGroup sog in m_attachments) 1222 {
1206 { 1223 sog.ScheduleGroupForFullUpdate();
1207 sog.ScheduleGroupForFullUpdate(); 1224 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
1208 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 1225 sog.ResumeScripts();
1209 sog.ResumeScripts();
1210 }
1211 });
1212 } 1226 }
1213 } 1227 }
1214 } 1228 }
@@ -2912,7 +2926,6 @@ namespace OpenSim.Region.Framework.Scenes
2912 Rotation = newRot; 2926 Rotation = newRot;
2913 2927
2914// ParentPosition = part.AbsolutePosition; 2928// ParentPosition = part.AbsolutePosition;
2915 part.ParentGroup.AddAvatar(UUID);
2916 } 2929 }
2917 else 2930 else
2918 { 2931 {
@@ -2921,13 +2934,13 @@ namespace OpenSim.Region.Framework.Scenes
2921 m_pos -= part.GroupPosition; 2934 m_pos -= part.GroupPosition;
2922 2935
2923// ParentPosition = part.AbsolutePosition; 2936// ParentPosition = part.AbsolutePosition;
2924 part.ParentGroup.AddAvatar(UUID);
2925 2937
2926// m_log.DebugFormat( 2938// m_log.DebugFormat(
2927// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", 2939// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
2928// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); 2940// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
2929 } 2941 }
2930 2942
2943 part.ParentGroup.AddAvatar(UUID);
2931 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); 2944 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2932 ParentID = m_requestedSitTargetID; 2945 ParentID = m_requestedSitTargetID;
2933 m_AngularVelocity = Vector3.Zero; 2946 m_AngularVelocity = Vector3.Zero;
@@ -3231,6 +3244,8 @@ namespace OpenSim.Region.Framework.Scenes
3231 // again here... this comes after the cached appearance check because the avatars 3244 // again here... this comes after the cached appearance check because the avatars
3232 // appearance goes into the avatar update packet 3245 // appearance goes into the avatar update packet
3233 SendAvatarDataToAllAgents(); 3246 SendAvatarDataToAllAgents();
3247
3248 // This invocation always shows up in the viewer logs as an error. Is it needed?
3234 SendAppearanceToAgent(this); 3249 SendAppearanceToAgent(this);
3235 3250
3236 // If we are using the the cached appearance then send it out to everyone 3251 // If we are using the the cached appearance then send it out to everyone