diff options
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.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 42 |
1 files changed, 19 insertions, 23 deletions
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 | ||