* Patch attached that adds the check for uninitialized appearance when inventory items are received and processed. Also attempts to ensure that appearance is initialized even 
when the profile cache has not been built.
* This will not fix the race condition, but should at least remove the unhandled exception that is being reported in Mantis 0002126.
* Thanks cmickeyb
0.6.0-stable
Justin Clarke Casey 2008-09-12 21:32:45 +00:00
parent 1edee634ca
commit 9cdd9e215c
2 changed files with 26 additions and 13 deletions

View File

@ -2382,24 +2382,23 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="appearance"></param> /// <param name="appearance"></param>
public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
{ {
appearance = null; // VS needs this line, mono doesn't appearance = new AvatarAppearance();
try try
{ {
if (m_AvatarFactory == null || if (m_AvatarFactory != null)
!m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
{ {
m_log.Warn("[APPEARANCE]: Appearance not found, creating default"); if (m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
appearance = new AvatarAppearance(); return;
} }
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}, {2}",
"[APPERANCE]: Problem when fetching appearance for avatar {0}, {1}, using default. {2}", client.Name, client.AgentId, e.ToString());
client.Name, client.AgentId, e);
appearance = new AvatarAppearance();
} }
m_log.Warn("[APPEARANCE]: Appearance not found, returning default");
} }
/// <summary> /// <summary>

View File

@ -2911,19 +2911,33 @@ namespace OpenSim.Region.Environment.Scenes
private void ItemReceived(UUID itemID) private void ItemReceived(UUID itemID)
{ {
if (null == m_appearance)
{
m_log.Warn("[ATTACHMENT] Appearance has not been initialized");
return;
}
int attachpoint = m_appearance.GetAttachpoint(itemID); int attachpoint = m_appearance.GetAttachpoint(itemID);
if (attachpoint == 0) if (attachpoint == 0)
return; return;
UUID asset = m_appearance.GetAttachedAsset(attachpoint); UUID asset = m_appearance.GetAttachedAsset(attachpoint);
if (asset == UUID.Zero) // We have just logged in if (UUID.Zero == asset) // We have just logged in
{ {
m_log.InfoFormat("[ATTACHMENT] Rez attachment {0}", m_log.InfoFormat("[ATTACHMENT] Rez attachment {0}",
itemID.ToString()); itemID.ToString());
try
{
// Rez from inventory // Rez from inventory
m_scene.RezSingleAttachment(ControllingClient, itemID, m_scene.RezSingleAttachment(ControllingClient, itemID,
(uint)attachpoint, 0, 0); (uint)attachpoint, 0, 0);
}
catch (Exception e)
{
m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString());
}
return; return;
} }