From 1d5e870ee2a45d6df6f2114c8df90de0015bcb6e Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sun, 14 Sep 2008 02:56:51 +0000 Subject: [PATCH] Thank you kindly, CMickeyb for a patch that: Moved intialization of appearance from the SendInitialData event handler into CompleteMovement handler. That ensures that m_appearance is initialized before the inventory is retrieved (so there is a place to check on attachments). --- OpenSim/Data/MySQL/MySQLUserData.cs | 6 ++++++ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 81acbfb42c..5f7db15bd5 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -722,6 +722,12 @@ namespace OpenSim.Data.MySQL reader.Dispose(); result.Dispose(); + if (null == appearance) + { + m_log.WarnFormat("[USER DB] No appearance found for user {0}", user.ToString()); + return null; + } + appearance.SetAttachments(GetUserAttachments(user)); return appearance; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index f58bba6aed..7428612655 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -805,6 +805,11 @@ namespace OpenSim.Region.Environment.Scenes m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); + // Moved this from SendInitialData to ensure that m_appearance is initialized + // before the inventory is processed in MakeRootAgent. This fixes a race condition + // related to the handling of attachments + m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); + if (m_isChildAgent) { m_isChildAgent = false; @@ -1712,14 +1717,14 @@ namespace OpenSim.Region.Environment.Scenes m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); } - /// /// Do everything required once a client completes its movement into a region /// public void SendInitialData() { - // Needed for standalone - m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); + // Moved this into CompleteMovement to ensure that m_appearance is initialized before + // the inventory arrives + // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); // Note: because Quaternion is a struct, it can't be null Quaternion rot = m_bodyRot;