aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2009-10-07 01:44:36 +0100
committerMelanie2009-10-07 01:44:36 +0100
commit9618c196c274fefda4437eff6d25c7a12e7a3ee1 (patch)
treeb860a6f957e3d0b2504ca2ec6802b1a211e4a3de /OpenSim/Region
parentCommented noisy debugging about packet splitting (diff)
downloadopensim-SC-9618c196c274fefda4437eff6d25c7a12e7a3ee1.zip
opensim-SC-9618c196c274fefda4437eff6d25c7a12e7a3ee1.tar.gz
opensim-SC-9618c196c274fefda4437eff6d25c7a12e7a3ee1.tar.bz2
opensim-SC-9618c196c274fefda4437eff6d25c7a12e7a3ee1.tar.xz
Revert "Merging in diva's locking fixes"
This reverts commit 832cc685138b2244529f10b54b373c34adb4a633.
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, 127 insertions, 174 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 60dab5f..84e705a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3546,7 +3546,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3546 objectData.TextureAnim = textureanim; 3546 objectData.TextureAnim = textureanim;
3547 } 3547 }
3548 3548
3549 bool doUpdate = false;
3550 lock (m_primFullUpdates) 3549 lock (m_primFullUpdates)
3551 { 3550 {
3552 if (m_primFullUpdates.Count == 0) 3551 if (m_primFullUpdates.Count == 0)
@@ -3555,10 +3554,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3555 m_primFullUpdates.Add(objectData); 3554 m_primFullUpdates.Add(objectData);
3556 3555
3557 if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket) 3556 if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket)
3558 doUpdate = true; 3557 ProcessPrimFullUpdates(this, null);
3559 } 3558 }
3560 if (doUpdate)
3561 ProcessPrimFullUpdates(this, null);
3562 } 3559 }
3563 3560
3564 void HandleQueueEmpty(ThrottleOutPacketType queue) 3561 void HandleQueueEmpty(ThrottleOutPacketType queue)
@@ -3579,40 +3576,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3579 3576
3580 void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) 3577 void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e)
3581 { 3578 {
3582 bool stopTimer = false;
3583 lock (m_primFullUpdates) 3579 lock (m_primFullUpdates)
3584 { 3580 {
3585 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) 3581 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
3586 stopTimer = true; 3582 {
3587 } 3583 lock (m_primFullUpdateTimer)
3588 if (stopTimer) 3584 m_primFullUpdateTimer.Stop();
3589 { 3585
3590 lock (m_primFullUpdateTimer) 3586 return;
3591 m_primFullUpdateTimer.Stop(); 3587 }
3592 return;
3593 }
3594 3588
3595 ObjectUpdatePacket outPacket = 3589 ObjectUpdatePacket outPacket =
3596 (ObjectUpdatePacket)PacketPool.Instance.GetPacket( 3590 (ObjectUpdatePacket)PacketPool.Instance.GetPacket(
3597 PacketType.ObjectUpdate); 3591 PacketType.ObjectUpdate);
3598 3592
3599 outPacket.RegionData.RegionHandle = 3593 outPacket.RegionData.RegionHandle =
3600 Scene.RegionInfo.RegionHandle; 3594 Scene.RegionInfo.RegionHandle;
3601 outPacket.RegionData.TimeDilation = 3595 outPacket.RegionData.TimeDilation =
3602 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3596 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3603 3597
3604 int max = m_primFullUpdates.Count; 3598 int max = m_primFullUpdates.Count;
3605 if (max > m_primFullUpdatesPerPacket) 3599 if (max > m_primFullUpdatesPerPacket)
3606 max = m_primFullUpdatesPerPacket; 3600 max = m_primFullUpdatesPerPacket;
3607 3601
3608 int count = 0; 3602 int count = 0;
3609 int size = 0; 3603 int size = 0;
3610 3604
3611 byte[] zerobuffer = new byte[1024]; 3605 byte[] zerobuffer = new byte[1024];
3612 byte[] blockbuffer = new byte[1024]; 3606 byte[] blockbuffer = new byte[1024];
3613 3607
3614 lock (m_primFullUpdates)
3615 {
3616 for (count = 0 ; count < max ; count++) 3608 for (count = 0 ; count < max ; count++)
3617 { 3609 {
3618 int length = 0; 3610 int length = 0;
@@ -3636,12 +3628,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3636 OutPacket(outPacket, ThrottleOutPacketType.Task); 3628 OutPacket(outPacket, ThrottleOutPacketType.Task);
3637 3629
3638 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) 3630 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
3639 stopTimer = true; 3631 lock (m_primFullUpdateTimer)
3632 m_primFullUpdateTimer.Stop();
3640 } 3633 }
3641
3642 if (stopTimer)
3643 lock (m_primFullUpdateTimer)
3644 m_primFullUpdateTimer.Stop();
3645 } 3634 }
3646 3635
3647 /// <summary> 3636 /// <summary>
@@ -3660,7 +3649,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3660 CreatePrimImprovedBlock(localID, position, rotation, 3649 CreatePrimImprovedBlock(localID, position, rotation,
3661 velocity, rotationalvelocity, state); 3650 velocity, rotationalvelocity, state);
3662 3651
3663 bool doUpdate = false;
3664 lock (m_primTerseUpdates) 3652 lock (m_primTerseUpdates)
3665 { 3653 {
3666 if (m_primTerseUpdates.Count == 0) 3654 if (m_primTerseUpdates.Count == 0)
@@ -3669,51 +3657,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3669 m_primTerseUpdates.Add(objectData); 3657 m_primTerseUpdates.Add(objectData);
3670 3658
3671 if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket) 3659 if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket)
3672 doUpdate = true; 3660 ProcessPrimTerseUpdates(this, null);
3673 } 3661 }
3674 if (doUpdate)
3675 ProcessPrimTerseUpdates(this, null);
3676 } 3662 }
3677 3663
3678 void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e) 3664 void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e)
3679 { 3665 {
3680 bool stopTimer = false;
3681 lock (m_primTerseUpdates) 3666 lock (m_primTerseUpdates)
3682 { 3667 {
3683 if (m_primTerseUpdates.Count == 0) 3668 if (m_primTerseUpdates.Count == 0)
3684 stopTimer = true; 3669 {
3685 } 3670 lock (m_primTerseUpdateTimer)
3686 if (stopTimer) 3671 m_primTerseUpdateTimer.Stop();
3687 {
3688 lock (m_primTerseUpdateTimer)
3689 m_primTerseUpdateTimer.Stop();
3690 3672
3691 return; 3673 return;
3692 } 3674 }
3693 3675
3694 ImprovedTerseObjectUpdatePacket outPacket = 3676 ImprovedTerseObjectUpdatePacket outPacket =
3695 (ImprovedTerseObjectUpdatePacket) 3677 (ImprovedTerseObjectUpdatePacket)
3696 PacketPool.Instance.GetPacket( 3678 PacketPool.Instance.GetPacket(
3697 PacketType.ImprovedTerseObjectUpdate); 3679 PacketType.ImprovedTerseObjectUpdate);
3698 3680
3699 outPacket.RegionData.RegionHandle = 3681 outPacket.RegionData.RegionHandle =
3700 Scene.RegionInfo.RegionHandle; 3682 Scene.RegionInfo.RegionHandle;
3701 outPacket.RegionData.TimeDilation = 3683 outPacket.RegionData.TimeDilation =
3702 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3684 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3703 3685
3704 int max = m_primTerseUpdates.Count; 3686 int max = m_primTerseUpdates.Count;
3705 if (max > m_primTerseUpdatesPerPacket) 3687 if (max > m_primTerseUpdatesPerPacket)
3706 max = m_primTerseUpdatesPerPacket; 3688 max = m_primTerseUpdatesPerPacket;
3707 3689
3708 int count = 0; 3690 int count = 0;
3709 int size = 0; 3691 int size = 0;
3710 3692
3711 byte[] zerobuffer = new byte[1024]; 3693 byte[] zerobuffer = new byte[1024];
3712 byte[] blockbuffer = new byte[1024]; 3694 byte[] blockbuffer = new byte[1024];
3713 3695
3714 lock (m_primTerseUpdates) 3696 for (count = 0 ; count < max ; count++)
3715 {
3716 for (count = 0; count < max; count++)
3717 { 3697 {
3718 int length = 0; 3698 int length = 0;
3719 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); 3699 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length);
@@ -3738,11 +3718,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3738 OutPacket(outPacket, ThrottleOutPacketType.Task); 3718 OutPacket(outPacket, ThrottleOutPacketType.Task);
3739 3719
3740 if (m_primTerseUpdates.Count == 0) 3720 if (m_primTerseUpdates.Count == 0)
3741 stopTimer = true; 3721 lock (m_primTerseUpdateTimer)
3722 m_primTerseUpdateTimer.Stop();
3742 } 3723 }
3743 if (stopTimer)
3744 lock (m_primTerseUpdateTimer)
3745 m_primTerseUpdateTimer.Stop();
3746 } 3724 }
3747 3725
3748 public void FlushPrimUpdates() 3726 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