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