aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-25 22:48:13 +0100
committerJustin Clark-Casey (justincc)2012-06-25 22:48:13 +0100
commite5b739aaebace6b028f3f6bf05d21ff7a7c5affe (patch)
treef76c578681da34fddb0c36eeada8af57eaf0bbc4 /OpenSim/Region/Framework
parentIn AttachmentsModule.DetachSingleAttachmentToInvInternal(), remove attachment... (diff)
downloadopensim-SC_OLD-e5b739aaebace6b028f3f6bf05d21ff7a7c5affe.zip
opensim-SC_OLD-e5b739aaebace6b028f3f6bf05d21ff7a7c5affe.tar.gz
opensim-SC_OLD-e5b739aaebace6b028f3f6bf05d21ff7a7c5affe.tar.bz2
opensim-SC_OLD-e5b739aaebace6b028f3f6bf05d21ff7a7c5affe.tar.xz
When attachments are being saved and deleted for a closing root agent, delete first to avoid a hud race condition with update threads.
If delete doesn't occur first then the update thread can outrace the IsAttachment = false necessary to save attachments and send hud artifacts to other viewers.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs3
3 files changed, 21 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index eb07165..fde5de1 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -43,10 +43,15 @@ namespace OpenSim.Region.Framework.Interfaces
43 void RezAttachments(IScenePresence sp); 43 void RezAttachments(IScenePresence sp);
44 44
45 /// <summary> 45 /// <summary>
46 /// Save the attachments that have change on this presence. 46 /// Derez the attachements for a scene presence that is closing.
47 /// </summary> 47 /// </summary>
48 /// <param name="sp"></param> 48 /// <remarks>
49 void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted); 49 /// Attachment changes are saved.
50 /// </remarks>
51 /// <param name="sp">The presence closing</param>
52 /// <param name="saveChanged">Save changed attachments.</param>
53 /// <param name="saveAllScripted">Save attachments with scripts even if they haven't changed.</para>
54 void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted);
50 55
51 /// <summary> 56 /// <summary>
52 /// Delete all the presence's attachments from the scene 57 /// Delete all the presence's attachments from the scene
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 385febf..d449116 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -500,6 +500,7 @@ namespace OpenSim.Region.Framework.Scenes
500 public IAttachmentsModule AttachmentsModule { get; set; } 500 public IAttachmentsModule AttachmentsModule { get; set; }
501 public IEntityTransferModule EntityTransferModule { get; private set; } 501 public IEntityTransferModule EntityTransferModule { get; private set; }
502 public IAgentAssetTransactions AgentTransactionsModule { get; private set; } 502 public IAgentAssetTransactions AgentTransactionsModule { get; private set; }
503 public IUserManagement UserManagementModule { get; private set; }
503 504
504 public IAvatarFactoryModule AvatarFactory 505 public IAvatarFactoryModule AvatarFactory
505 { 506 {
@@ -1243,6 +1244,7 @@ namespace OpenSim.Region.Framework.Scenes
1243 EntityTransferModule = RequestModuleInterface<IEntityTransferModule>(); 1244 EntityTransferModule = RequestModuleInterface<IEntityTransferModule>();
1244 m_groupsModule = RequestModuleInterface<IGroupsModule>(); 1245 m_groupsModule = RequestModuleInterface<IGroupsModule>();
1245 AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>(); 1246 AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>();
1247 UserManagementModule = RequestModuleInterface<IUserManagement>();
1246 } 1248 }
1247 1249
1248 #endregion 1250 #endregion
@@ -2021,9 +2023,8 @@ namespace OpenSim.Region.Framework.Scenes
2021 sceneObject.SetGroup(groupID, null); 2023 sceneObject.SetGroup(groupID, null);
2022 } 2024 }
2023 2025
2024 IUserManagement uman = RequestModuleInterface<IUserManagement>(); 2026 if (UserManagementModule != null)
2025 if (uman != null) 2027 sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID);
2026 sceneObject.RootPart.CreatorIdentification = uman.GetUserUUI(ownerID);
2027 2028
2028 sceneObject.ScheduleGroupForFullUpdate(); 2029 sceneObject.ScheduleGroupForFullUpdate();
2029 2030
@@ -2711,14 +2712,13 @@ namespace OpenSim.Region.Framework.Scenes
2711 /// <param name="aCircuit"></param> 2712 /// <param name="aCircuit"></param>
2712 private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) 2713 private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit)
2713 { 2714 {
2714 IUserManagement uMan = RequestModuleInterface<IUserManagement>(); 2715 if (UserManagementModule != null)
2715 if (uMan != null)
2716 { 2716 {
2717 string first = aCircuit.firstname, last = aCircuit.lastname; 2717 string first = aCircuit.firstname, last = aCircuit.lastname;
2718 2718
2719 if (sp.PresenceType == PresenceType.Npc) 2719 if (sp.PresenceType == PresenceType.Npc)
2720 { 2720 {
2721 uMan.AddUser(aCircuit.AgentID, first, last); 2721 UserManagementModule.AddUser(aCircuit.AgentID, first, last);
2722 } 2722 }
2723 else 2723 else
2724 { 2724 {
@@ -2737,7 +2737,7 @@ namespace OpenSim.Region.Framework.Scenes
2737 } 2737 }
2738 } 2738 }
2739 2739
2740 uMan.AddUser(aCircuit.AgentID, first, last, homeURL); 2740 UserManagementModule.AddUser(aCircuit.AgentID, first, last, homeURL);
2741 } 2741 }
2742 } 2742 }
2743 } 2743 }
@@ -3292,17 +3292,19 @@ namespace OpenSim.Region.Framework.Scenes
3292 3292
3293 if (!isChildAgent) 3293 if (!isChildAgent)
3294 { 3294 {
3295 if (AttachmentsModule != null && avatar.PresenceType != PresenceType.Npc) 3295 if (AttachmentsModule != null)
3296 { 3296 {
3297 IUserManagement uMan = RequestModuleInterface<IUserManagement>();
3298 // Don't save attachments for HG visitors, it 3297 // Don't save attachments for HG visitors, it
3299 // messes up their inventory. When a HG visitor logs 3298 // messes up their inventory. When a HG visitor logs
3300 // out on a foreign grid, their attachments will be 3299 // out on a foreign grid, their attachments will be
3301 // reloaded in the state they were in when they left 3300 // reloaded in the state they were in when they left
3302 // the home grid. This is best anyway as the visited 3301 // the home grid. This is best anyway as the visited
3303 // grid may use an incompatible script engine. 3302 // grid may use an incompatible script engine.
3304 if (uMan == null || uMan.IsLocalGridUser(avatar.UUID)) 3303 bool saveChanged
3305 AttachmentsModule.SaveChangedAttachments(avatar, false); 3304 = avatar.PresenceType != PresenceType.Npc
3305 && (UserManagementModule == null || UserManagementModule.IsLocalGridUser(avatar.UUID));
3306
3307 AttachmentsModule.DeRezAttachments(avatar, saveChanged, false);
3306 } 3308 }
3307 3309
3308 ForEachClient( 3310 ForEachClient(
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3909fd4..909c7c8 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3416,9 +3416,6 @@ namespace OpenSim.Region.Framework.Scenes
3416 3416
3417 public void Close() 3417 public void Close()
3418 { 3418 {
3419 if (!IsChildAgent && m_scene.AttachmentsModule != null)
3420 m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false);
3421
3422 // Clear known regions 3419 // Clear known regions
3423 KnownRegions = new Dictionary<ulong, string>(); 3420 KnownRegions = new Dictionary<ulong, string>();
3424 3421