fix crash in standalone mode for initial appearance setup

0.6.0-stable
Sean Dague 2008-05-19 20:33:54 +00:00
parent 01b5425a2d
commit 7a52b35c57
3 changed files with 16 additions and 7 deletions

View File

@ -1549,6 +1549,14 @@ namespace OpenSim.Region.Environment.Scenes
presence = m_restorePresences[client.AgentId]; presence = m_restorePresences[client.AgentId];
m_restorePresences.Remove(client.AgentId); m_restorePresences.Remove(client.AgentId);
// This is one of two paths to create avatars that are
// used. This tends to get called more in standalone
// than grid, not really sure why, but as such needs
// an explicity appearance lookup here.
AvatarAppearance appearance = null;
GetAvatarAppearance(client, out appearance);
presence.Appearance = appearance;
presence.initializeScenePresence(client, RegionInfo, this); presence.initializeScenePresence(client, RegionInfo, this);
m_innerScene.AddScenePresence(presence); m_innerScene.AddScenePresence(presence);
@ -1789,10 +1797,8 @@ namespace OpenSim.Region.Environment.Scenes
return avatar; return avatar;
} }
protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
{ {
appearance = CommsManager.UserService.GetUserAppearance(client.AgentId);
if (m_AvatarFactory == null || if (m_AvatarFactory == null ||
!m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
{ {

View File

@ -405,8 +405,6 @@ namespace OpenSim.Region.Environment.Scenes
RegisterToEvents(); RegisterToEvents();
SetDirectionVectors(); SetDirectionVectors();
m_appearance = m_scene.CommsManager.UserService.GetUserAppearance(client.AgentId);
try try
{ {
m_scene.LandChannel.SendLandUpdate(this, true); m_scene.LandChannel.SendLandUpdate(this, true);
@ -1445,6 +1443,9 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendInitialData() public void SendInitialData()
{ {
// Needed for standalone
m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
m_pos, m_appearance.Texture.ToBytes(), m_parentID); m_pos, m_appearance.Texture.ToBytes(), m_parentID);
@ -2049,7 +2050,6 @@ namespace OpenSim.Region.Environment.Scenes
m_controllingClient = client; m_controllingClient = client;
m_regionInfo = region; m_regionInfo = region;
m_scene = scene; m_scene = scene;
m_appearance = m_scene.CommsManager.UserService.GetUserAppearance(client.AgentId);
RegisterToEvents(); RegisterToEvents();

View File

@ -60,7 +60,10 @@ namespace OpenSim.Region.Modules.AvatarFactory
public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance)
{ {
appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId); appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId);
return true; if (appearance != null)
return true;
else
return false;
// //should only let one thread at a time do this part // //should only let one thread at a time do this part
// EventWaitHandle waitHandle = null; // EventWaitHandle waitHandle = null;