aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-10-07 01:45:49 +0100
committerMelanie2009-10-07 01:45:49 +0100
commit89d23a1fa23cb191e7ebde047311adcadf3b2e45 (patch)
tree461ef0fdd6640a17db5b3d989f0e02b1cf40252e
parentRewrote parts of the code that were double-locking different objects. This is... (diff)
downloadopensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.zip
opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.tar.gz
opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.tar.bz2
opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.tar.xz
Revert "Rewrote parts of the code that were double-locking different objects. This is about half of the code base reviewed."
This reverts commit e992ca025571a891333a57012c2cd4419b6581e5.
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs66
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs116
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs42
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs37
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs36
9 files changed, 166 insertions, 201 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index b02cf5b..9e12d948 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -128,18 +128,24 @@ namespace OpenSim.Framework.Communications.Cache
128 /// <returns>null if no user details are found</returns> 128 /// <returns>null if no user details are found</returns>
129 public CachedUserInfo GetUserDetails(string fname, string lname) 129 public CachedUserInfo GetUserDetails(string fname, string lname)
130 { 130 {
131 CachedUserInfo userInfo;
132 lock (m_userProfilesByName) 131 lock (m_userProfilesByName)
133 { 132 {
133 CachedUserInfo userInfo;
134
134 if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo)) 135 if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo))
136 {
135 return userInfo; 137 return userInfo;
138 }
139 else
140 {
141 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
142
143 if (userProfile != null)
144 return AddToCaches(userProfile);
145 else
146 return null;
147 }
136 } 148 }
137 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
138
139 if (userProfile != null)
140 return AddToCaches(userProfile);
141 else
142 return null;
143 } 149 }
144 150
145 /// <summary> 151 /// <summary>
@@ -154,14 +160,20 @@ namespace OpenSim.Framework.Communications.Cache
154 return null; 160 return null;
155 161
156 lock (m_userProfilesById) 162 lock (m_userProfilesById)
163 {
157 if (m_userProfilesById.ContainsKey(userID)) 164 if (m_userProfilesById.ContainsKey(userID))
165 {
158 return m_userProfilesById[userID]; 166 return m_userProfilesById[userID];
159 167 }
160 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID); 168 else
161 if (userProfile != null) 169 {
162 return AddToCaches(userProfile); 170 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
163 else 171 if (userProfile != null)
164 return null; 172 return AddToCaches(userProfile);
173 else
174 return null;
175 }
176 }
165 } 177 }
166 178
167 /// <summary> 179 /// <summary>
@@ -199,10 +211,14 @@ namespace OpenSim.Framework.Communications.Cache
199 CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile); 211 CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile);
200 212
201 lock (m_userProfilesById) 213 lock (m_userProfilesById)
214 {
202 m_userProfilesById[createdUserInfo.UserProfile.ID] = createdUserInfo; 215 m_userProfilesById[createdUserInfo.UserProfile.ID] = createdUserInfo;
203 216
204 lock (m_userProfilesByName) 217 lock (m_userProfilesByName)
205 m_userProfilesByName[createdUserInfo.UserProfile.Name] = createdUserInfo; 218 {
219 m_userProfilesByName[createdUserInfo.UserProfile.Name] = createdUserInfo;
220 }
221 }
206 222
207 return createdUserInfo; 223 return createdUserInfo;
208 } 224 }
@@ -214,25 +230,21 @@ namespace OpenSim.Framework.Communications.Cache
214 /// <returns>true if there was a profile to remove, false otherwise</returns> 230 /// <returns>true if there was a profile to remove, false otherwise</returns>
215 protected bool RemoveFromCaches(UUID userId) 231 protected bool RemoveFromCaches(UUID userId)
216 { 232 {
217 CachedUserInfo userInfo = null;
218 lock (m_userProfilesById) 233 lock (m_userProfilesById)
219 { 234 {
220 if (m_userProfilesById.ContainsKey(userId)) 235 if (m_userProfilesById.ContainsKey(userId))
221 { 236 {
222 userInfo = m_userProfilesById[userId]; 237 CachedUserInfo userInfo = m_userProfilesById[userId];
223 m_userProfilesById.Remove(userId); 238 m_userProfilesById.Remove(userId);
224 } 239
225 } 240 lock (m_userProfilesByName)
226
227 if (userInfo != null)
228 lock (m_userProfilesByName)
229 {
230 if (m_userProfilesByName.ContainsKey(userInfo.UserProfile.Name))
231 { 241 {
232 m_userProfilesByName.Remove(userInfo.UserProfile.Name); 242 m_userProfilesByName.Remove(userInfo.UserProfile.Name);
233 return true;
234 } 243 }
244
245 return true;
235 } 246 }
247 }
236 248
237 return false; 249 return false;
238 } 250 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index fe37a08..0052729 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3122,7 +3122,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3122 objectData.TextureAnim = textureanim; 3122 objectData.TextureAnim = textureanim;
3123 } 3123 }
3124 3124
3125 bool doUpdate = false;
3126 lock (m_primFullUpdates) 3125 lock (m_primFullUpdates)
3127 { 3126 {
3128 if (m_primFullUpdates.Count == 0) 3127 if (m_primFullUpdates.Count == 0)
@@ -3131,10 +3130,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3131 m_primFullUpdates.Add(objectData); 3130 m_primFullUpdates.Add(objectData);
3132 3131
3133 if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket) 3132 if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket)
3134 doUpdate = true; 3133 ProcessPrimFullUpdates(this, null);
3135 } 3134 }
3136 if (doUpdate)
3137 ProcessPrimFullUpdates(this, null);
3138 } 3135 }
3139 3136
3140 void HandleQueueEmpty(ThrottleOutPacketType queue) 3137 void HandleQueueEmpty(ThrottleOutPacketType queue)
@@ -3155,40 +3152,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3155 3152
3156 void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) 3153 void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e)
3157 { 3154 {
3158 bool stopTimer = false;
3159 lock (m_primFullUpdates) 3155 lock (m_primFullUpdates)
3160 { 3156 {
3161 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) 3157 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
3162 stopTimer = true; 3158 {
3163 } 3159 lock (m_primFullUpdateTimer)
3164 if (stopTimer) 3160 m_primFullUpdateTimer.Stop();
3165 { 3161
3166 lock (m_primFullUpdateTimer) 3162 return;
3167 m_primFullUpdateTimer.Stop(); 3163 }
3168 return;
3169 }
3170 3164
3171 ObjectUpdatePacket outPacket = 3165 ObjectUpdatePacket outPacket =
3172 (ObjectUpdatePacket)PacketPool.Instance.GetPacket( 3166 (ObjectUpdatePacket)PacketPool.Instance.GetPacket(
3173 PacketType.ObjectUpdate); 3167 PacketType.ObjectUpdate);
3174 3168
3175 outPacket.RegionData.RegionHandle = 3169 outPacket.RegionData.RegionHandle =
3176 Scene.RegionInfo.RegionHandle; 3170 Scene.RegionInfo.RegionHandle;
3177 outPacket.RegionData.TimeDilation = 3171 outPacket.RegionData.TimeDilation =
3178 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3172 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3179 3173
3180 int max = m_primFullUpdates.Count; 3174 int max = m_primFullUpdates.Count;
3181 if (max > m_primFullUpdatesPerPacket) 3175 if (max > m_primFullUpdatesPerPacket)
3182 max = m_primFullUpdatesPerPacket; 3176 max = m_primFullUpdatesPerPacket;
3183 3177
3184 int count = 0; 3178 int count = 0;
3185 int size = 0; 3179 int size = 0;
3186 3180
3187 byte[] zerobuffer = new byte[1024]; 3181 byte[] zerobuffer = new byte[1024];
3188 byte[] blockbuffer = new byte[1024]; 3182 byte[] blockbuffer = new byte[1024];
3189 3183
3190 lock (m_primFullUpdates)
3191 {
3192 for (count = 0 ; count < max ; count++) 3184 for (count = 0 ; count < max ; count++)
3193 { 3185 {
3194 int length = 0; 3186 int length = 0;
@@ -3212,12 +3204,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3212 OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); 3204 OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority);
3213 3205
3214 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) 3206 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
3215 stopTimer = true; 3207 lock (m_primFullUpdateTimer)
3208 m_primFullUpdateTimer.Stop();
3216 } 3209 }
3217
3218 if (stopTimer)
3219 lock (m_primFullUpdateTimer)
3220 m_primFullUpdateTimer.Stop();
3221 } 3210 }
3222 3211
3223 /// <summary> 3212 /// <summary>
@@ -3236,7 +3225,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3236 CreatePrimImprovedBlock(localID, position, rotation, 3225 CreatePrimImprovedBlock(localID, position, rotation,
3237 velocity, rotationalvelocity, state); 3226 velocity, rotationalvelocity, state);
3238 3227
3239 bool doUpdate = false;
3240 lock (m_primTerseUpdates) 3228 lock (m_primTerseUpdates)
3241 { 3229 {
3242 if (m_primTerseUpdates.Count == 0) 3230 if (m_primTerseUpdates.Count == 0)
@@ -3245,51 +3233,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3245 m_primTerseUpdates.Add(objectData); 3233 m_primTerseUpdates.Add(objectData);
3246 3234
3247 if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket) 3235 if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket)
3248 doUpdate = true; 3236 ProcessPrimTerseUpdates(this, null);
3249 } 3237 }
3250 if (doUpdate)
3251 ProcessPrimTerseUpdates(this, null);
3252 } 3238 }
3253 3239
3254 void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e) 3240 void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e)
3255 { 3241 {
3256 bool stopTimer = false;
3257 lock (m_primTerseUpdates) 3242 lock (m_primTerseUpdates)
3258 { 3243 {
3259 if (m_primTerseUpdates.Count == 0) 3244 if (m_primTerseUpdates.Count == 0)
3260 stopTimer = true; 3245 {
3261 } 3246 lock (m_primTerseUpdateTimer)
3262 if (stopTimer) 3247 m_primTerseUpdateTimer.Stop();
3263 {
3264 lock (m_primTerseUpdateTimer)
3265 m_primTerseUpdateTimer.Stop();
3266 3248
3267 return; 3249 return;
3268 } 3250 }
3269 3251
3270 ImprovedTerseObjectUpdatePacket outPacket = 3252 ImprovedTerseObjectUpdatePacket outPacket =
3271 (ImprovedTerseObjectUpdatePacket) 3253 (ImprovedTerseObjectUpdatePacket)
3272 PacketPool.Instance.GetPacket( 3254 PacketPool.Instance.GetPacket(
3273 PacketType.ImprovedTerseObjectUpdate); 3255 PacketType.ImprovedTerseObjectUpdate);
3274 3256
3275 outPacket.RegionData.RegionHandle = 3257 outPacket.RegionData.RegionHandle =
3276 Scene.RegionInfo.RegionHandle; 3258 Scene.RegionInfo.RegionHandle;
3277 outPacket.RegionData.TimeDilation = 3259 outPacket.RegionData.TimeDilation =
3278 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3260 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3279 3261
3280 int max = m_primTerseUpdates.Count; 3262 int max = m_primTerseUpdates.Count;
3281 if (max > m_primTerseUpdatesPerPacket) 3263 if (max > m_primTerseUpdatesPerPacket)
3282 max = m_primTerseUpdatesPerPacket; 3264 max = m_primTerseUpdatesPerPacket;
3283 3265
3284 int count = 0; 3266 int count = 0;
3285 int size = 0; 3267 int size = 0;
3286 3268
3287 byte[] zerobuffer = new byte[1024]; 3269 byte[] zerobuffer = new byte[1024];
3288 byte[] blockbuffer = new byte[1024]; 3270 byte[] blockbuffer = new byte[1024];
3289 3271
3290 lock (m_primTerseUpdates) 3272 for (count = 0 ; count < max ; count++)
3291 {
3292 for (count = 0; count < max; count++)
3293 { 3273 {
3294 int length = 0; 3274 int length = 0;
3295 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); 3275 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length);
@@ -3314,11 +3294,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3314 OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); 3294 OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority);
3315 3295
3316 if (m_primTerseUpdates.Count == 0) 3296 if (m_primTerseUpdates.Count == 0)
3317 stopTimer = true; 3297 lock (m_primTerseUpdateTimer)
3298 m_primTerseUpdateTimer.Stop();
3318 } 3299 }
3319 if (stopTimer)
3320 lock (m_primTerseUpdateTimer)
3321 m_primTerseUpdateTimer.Stop();
3322 } 3300 }
3323 3301
3324 public void FlushPrimUpdates() 3302 public void FlushPrimUpdates()
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 4abad81..fc7d63a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -442,46 +442,42 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
442 442
443 private ScenePresence GetRootPresenceFromAgentID(UUID AgentID) 443 private ScenePresence GetRootPresenceFromAgentID(UUID AgentID)
444 { 444 {
445 List<Scene> scenes = null;
446 lock (m_scenes)
447 scenes = new List<Scene>(m_scenes.Values);
448
449 ScenePresence returnAgent = null; 445 ScenePresence returnAgent = null;
450 ScenePresence queryagent = null; 446 lock (m_scenes)
451 foreach (Scene scene in scenes)
452 { 447 {
453 queryagent = scene.GetScenePresence(AgentID); 448 ScenePresence queryagent = null;
454 if (queryagent != null) 449 foreach (Scene scene in m_scenes.Values)
455 { 450 {
456 if (!queryagent.IsChildAgent) 451 queryagent = scene.GetScenePresence(AgentID);
452 if (queryagent != null)
457 { 453 {
458 returnAgent = queryagent; 454 if (!queryagent.IsChildAgent)
459 break; 455 {
456 returnAgent = queryagent;
457 break;
458 }
460 } 459 }
461 } 460 }
462 } 461 }
463
464 return returnAgent; 462 return returnAgent;
465 } 463 }
466 464
467 private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID) 465 private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID)
468 { 466 {
469 List<Scene> scenes = null;
470 lock (m_scenes)
471 scenes = new List<Scene>(m_scenes.Values);
472
473 ScenePresence returnAgent = null; 467 ScenePresence returnAgent = null;
474 ScenePresence queryagent = null; 468 lock (m_scenes)
475 foreach (Scene scene in m_scenes.Values)
476 { 469 {
477 queryagent = scene.GetScenePresence(AgentID); 470 ScenePresence queryagent = null;
478 if (queryagent != null) 471 foreach (Scene scene in m_scenes.Values)
479 { 472 {
480 returnAgent = queryagent; 473 queryagent = scene.GetScenePresence(AgentID);
481 break; 474 if (queryagent != null)
475 {
476 returnAgent = queryagent;
477 break;
478 }
482 } 479 }
483 } 480 }
484
485 return returnAgent; 481 return returnAgent;
486 } 482 }
487 483
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
index 42dd7ff..ad05bab 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
@@ -290,14 +290,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
290 290
291 // get the agent. This should work every time, as we just got a packet from it 291 // get the agent. This should work every time, as we just got a packet from it
292 ScenePresence agent = null; 292 ScenePresence agent = null;
293 List<Scene> scenes = null;
294 lock (m_Scenes) 293 lock (m_Scenes)
295 scenes = new List<Scene>(m_Scenes);
296
297 foreach (Scene scene in scenes)
298 { 294 {
299 agent = scene.GetScenePresence(agentID); 295 foreach (Scene scene in m_Scenes)
300 if (agent != null) break; 296 {
297 agent = scene.GetScenePresence(agentID);
298 if (agent != null) break;
299 }
301 } 300 }
302 301
303 // just to be paranoid... 302 // just to be paranoid...
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index e6e0483..d9a021f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -111,17 +111,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
111 111
112 private Scene FindClientScene(UUID agentId) 112 private Scene FindClientScene(UUID agentId)
113 { 113 {
114 List<Scene> scenes = null;
115 lock (m_Scenelist) 114 lock (m_Scenelist)
116 scenes = new List<Scene>(m_Scenelist);
117
118 foreach (Scene scene in scenes)
119 { 115 {
120 ScenePresence presence = scene.GetScenePresence(agentId); 116 foreach (Scene scene in m_Scenelist)
121 if (presence != null)
122 { 117 {
123 if (!presence.IsChildAgent) 118 ScenePresence presence = scene.GetScenePresence(agentId);
124 return scene; 119 if (presence != null)
120 {
121 if (!presence.IsChildAgent)
122 return scene;
123 }
125 } 124 }
126 } 125 }
127 return null; 126 return null;
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
index f9f01fe..83f004d 100644
--- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
@@ -198,20 +198,19 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
198 198
199 private SceneObjectPart findPrim(UUID objectID, out string ObjectRegionName) 199 private SceneObjectPart findPrim(UUID objectID, out string ObjectRegionName)
200 { 200 {
201 List<Scene> scenes = null;
202 lock (m_Scenes) 201 lock (m_Scenes)
203 scenes = new List<Scene>(m_Scenes.Values);
204
205 foreach (Scene s in scenes)
206 { 202 {
207 SceneObjectPart part = s.GetSceneObjectPart(objectID); 203 foreach (Scene s in m_Scenes.Values)
208 if (part != null)
209 { 204 {
210 ObjectRegionName = s.RegionInfo.RegionName; 205 SceneObjectPart part = s.GetSceneObjectPart(objectID);
211 uint localX = (s.RegionInfo.RegionLocX * (int)Constants.RegionSize); 206 if (part != null)
212 uint localY = (s.RegionInfo.RegionLocY * (int)Constants.RegionSize); 207 {
213 ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")"; 208 ObjectRegionName = s.RegionInfo.RegionName;
214 return part; 209 uint localX = (s.RegionInfo.RegionLocX * (int)Constants.RegionSize);
210 uint localY = (s.RegionInfo.RegionLocY * (int)Constants.RegionSize);
211 ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")";
212 return part;
213 }
215 } 214 }
216 } 215 }
217 ObjectRegionName = string.Empty; 216 ObjectRegionName = string.Empty;
@@ -364,7 +363,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
364 public Email GetNextEmail(UUID objectID, string sender, string subject) 363 public Email GetNextEmail(UUID objectID, string sender, string subject)
365 { 364 {
366 List<Email> queue = null; 365 List<Email> queue = null;
367 List<UUID> removal = new List<UUID>();
368 366
369 lock (m_LastGetEmailCall) 367 lock (m_LastGetEmailCall)
370 { 368 {
@@ -377,6 +375,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
377 375
378 // Hopefully this isn't too time consuming. If it is, we can always push it into a worker thread. 376 // Hopefully this isn't too time consuming. If it is, we can always push it into a worker thread.
379 DateTime now = DateTime.Now; 377 DateTime now = DateTime.Now;
378 List<UUID> removal = new List<UUID>();
380 foreach (UUID uuid in m_LastGetEmailCall.Keys) 379 foreach (UUID uuid in m_LastGetEmailCall.Keys)
381 { 380 {
382 if ((now - m_LastGetEmailCall[uuid]) > m_QueueTimeout) 381 if ((now - m_LastGetEmailCall[uuid]) > m_QueueTimeout)
@@ -384,15 +383,15 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
384 removal.Add(uuid); 383 removal.Add(uuid);
385 } 384 }
386 } 385 }
387 }
388 386
389 foreach (UUID remove in removal) 387 foreach (UUID remove in removal)
390 { 388 {
391 lock (m_LastGetEmailCall)
392 m_LastGetEmailCall.Remove(remove); 389 m_LastGetEmailCall.Remove(remove);
393 390 lock (m_MailQueues)
394 lock (m_MailQueues) 391 {
395 m_MailQueues.Remove(remove); 392 m_MailQueues.Remove(remove);
393 }
394 }
396 } 395 }
397 396
398 lock (m_MailQueues) 397 lock (m_MailQueues)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 0fed1bd..d2b5cb1 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -187,16 +187,14 @@ namespace OpenSim.Region.CoreModules.World.Land
187 LandData newData = data.Copy(); 187 LandData newData = data.Copy();
188 newData.LocalID = local_id; 188 newData.LocalID = local_id;
189 189
190 ILandObject land = null;
191 lock (m_landList) 190 lock (m_landList)
192 { 191 {
193 if (m_landList.ContainsKey(local_id)) 192 if (m_landList.ContainsKey(local_id))
194 { 193 {
195 m_landList[local_id].LandData = newData; 194 m_landList[local_id].LandData = newData;
196 land = m_landList[local_id]; 195 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]);
197 } 196 }
198 } 197 }
199 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land);
200 } 198 }
201 199
202 public bool AllowedForcefulBans 200 public bool AllowedForcefulBans
@@ -506,7 +504,6 @@ namespace OpenSim.Region.CoreModules.World.Land
506 /// <param name="local_id">Land.localID of the peice of land to remove.</param> 504 /// <param name="local_id">Land.localID of the peice of land to remove.</param>
507 public void removeLandObject(int local_id) 505 public void removeLandObject(int local_id)
508 { 506 {
509 UUID id = UUID.Zero;
510 lock (m_landList) 507 lock (m_landList)
511 { 508 {
512 for (int x = 0; x < 64; x++) 509 for (int x = 0; x < 64; x++)
@@ -523,10 +520,9 @@ namespace OpenSim.Region.CoreModules.World.Land
523 } 520 }
524 } 521 }
525 522
526 id = m_landList[local_id].LandData.GlobalID; 523 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID);
527 m_landList.Remove(local_id); 524 m_landList.Remove(local_id);
528 } 525 }
529 m_scene.EventManager.TriggerLandObjectRemoved(id);
530 } 526 }
531 527
532 private void performFinalLandJoin(ILandObject master, ILandObject slave) 528 private void performFinalLandJoin(ILandObject master, ILandObject slave)
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index df9473d..5b571c7 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -122,13 +122,12 @@ namespace OpenSim.Region.Framework.Scenes
122 public bool InventoryDeQueueAndDelete() 122 public bool InventoryDeQueueAndDelete()
123 { 123 {
124 DeleteToInventoryHolder x = null; 124 DeleteToInventoryHolder x = null;
125 int left = 0;
126 125
127 try 126 try
128 { 127 {
129 lock (m_inventoryDeletes) 128 lock (m_inventoryDeletes)
130 { 129 {
131 left = m_inventoryDeletes.Count; 130 int left = m_inventoryDeletes.Count;
132 if (left > 0) 131 if (left > 0)
133 { 132 {
134 x = m_inventoryDeletes.Dequeue(); 133 x = m_inventoryDeletes.Dequeue();
@@ -137,26 +136,23 @@ namespace OpenSim.Region.Framework.Scenes
137 m_inventoryDeletes.Enqueue(x); 136 m_inventoryDeletes.Enqueue(x);
138 return true; 137 return true;
139 } 138 }
140 }
141 }
142 139
143 if (left > 0) 140 m_log.DebugFormat(
144 { 141 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
145 m_log.DebugFormat( 142
146 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); 143 try
147 144 {
148 try 145 m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient);
149 { 146 if (x.permissionToDelete)
150 m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); 147 m_scene.DeleteSceneObject(x.objectGroup, false);
151 if (x.permissionToDelete) 148 }
152 m_scene.DeleteSceneObject(x.objectGroup, false); 149 catch (Exception e)
153 } 150 {
154 catch (Exception e) 151 m_log.DebugFormat("Exception background sending object: " + e);
155 { 152 }
156 m_log.DebugFormat("Exception background sending object: " + e); 153
154 return true;
157 } 155 }
158
159 return true;
160 } 156 }
161 } 157 }
162 catch (Exception e) 158 catch (Exception e)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 20b3b5c..54ac792 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -297,44 +297,34 @@ namespace OpenSim.Region.Framework.Scenes
297 297
298 sceneObject.AttachToScene(m_parentScene); 298 sceneObject.AttachToScene(m_parentScene);
299 299
300 List<SceneObjectPart> parts = null;
301 bool found = false;
302 lock (sceneObject) 300 lock (sceneObject)
303 { 301 {
304 if (!Entities.ContainsKey(sceneObject.UUID)) 302 if (!Entities.ContainsKey(sceneObject.UUID))
305 { 303 {
306 found = true;
307 Entities.Add(sceneObject); 304 Entities.Add(sceneObject);
308 m_numPrim += sceneObject.Children.Count; 305 m_numPrim += sceneObject.Children.Count;
309 306
310 if (attachToBackup) 307 if (attachToBackup)
311 sceneObject.AttachToBackup(); 308 sceneObject.AttachToBackup();
312 309
313 parts = new List<SceneObjectPart>(sceneObject.Children.Values); 310 if (OnObjectCreate != null)
314 311 OnObjectCreate(sceneObject);
315 } 312
316 } 313 lock (m_dictionary_lock)
317
318 if (found)
319 {
320 lock (m_dictionary_lock)
321 {
322 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
323 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
324 foreach (SceneObjectPart part in parts)
325 { 314 {
326 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 315 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
327 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 316 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
317 foreach (SceneObjectPart part in sceneObject.Children.Values)
318 {
319 SceneObjectGroupsByFullID[part.UUID] = sceneObject;
320 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
321 }
328 } 322 }
329 }
330 323
331 if (OnObjectCreate != null) 324 return true;
332 OnObjectCreate(sceneObject); 325 }
333
334 return true;
335 } 326 }
336 327
337
338 return false; 328 return false;
339 } 329 }
340 330