Fix some crashes caused by the addition of the CreatorData column

avinationmerge
Melanie 2010-11-22 23:31:29 +01:00
parent 506192e466
commit 571becefb6
5 changed files with 34 additions and 2 deletions

View File

@ -967,6 +967,7 @@ namespace OpenSim.Framework.Capabilities
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.Owner = m_agentID; item.Owner = m_agentID;
item.CreatorId = m_agentID.ToString(); item.CreatorId = m_agentID.ToString();
item.CreatorData = String.Empty;
item.ID = inventoryItem; item.ID = inventoryItem;
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
item.Description = assetDescription; item.Description = assetDescription;

View File

@ -151,6 +151,7 @@ namespace OpenSim.Framework
while (!m_itemLock.TryEnterWriteLock(60000)) while (!m_itemLock.TryEnterWriteLock(60000))
{ {
m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
if (m_itemLock.IsWriteLockHeld) if (m_itemLock.IsWriteLockHeld)
{ {
m_itemLock = new System.Threading.ReaderWriterLockSlim(); m_itemLock = new System.Threading.ReaderWriterLockSlim();

View File

@ -436,9 +436,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
item = new InventoryItemBase(); item = new InventoryItemBase();
// Can't know creator is the same, so null it in inventory // Can't know creator is the same, so null it in inventory
if (objlist.Count > 1) if (objlist.Count > 1)
{
item.CreatorId = UUID.Zero.ToString(); item.CreatorId = UUID.Zero.ToString();
item.CreatorData = String.Empty;
}
else else
{
item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
item.CreatorData = objlist[0].RootPart.CreatorData;
}
item.ID = UUID.Random(); item.ID = UUID.Random();
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = folder.ID; item.Folder = folder.ID;

View File

@ -10177,6 +10177,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (str2 == String.Empty) if (str2 == String.Empty)
return str1; return str1;
int len = str2.Length;
if ((len % 4) != 0) // LL is EVIL!!!!
{
while (str2.EndsWith("="))
str2 = str2.Substring(0, str2.Length - 1);
len = str2.Length;
int mod = len % 4;
if (mod == 1)
str2 = str2.Substring(0, str2.Length - 1);
else if (mod == 2)
str2 += "==";
else if (mod == 3)
str2 += "=";
}
byte[] data1; byte[] data1;
byte[] data2; byte[] data2;
try try
@ -10200,7 +10217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
while (pos < data1.Length) while (pos < data1.Length)
{ {
int len = data1.Length - pos; len = data1.Length - pos;
if (len > data2.Length) if (len > data2.Length)
len = data2.Length; len = data2.Length;

View File

@ -302,6 +302,8 @@ namespace OpenSim.Services.Connectors
public bool AddItem(InventoryItemBase item) public bool AddItem(InventoryItemBase item)
{ {
if (item.CreatorData == null)
item.CreatorData = String.Empty;
Dictionary<string,object> ret = MakeRequest("ADDITEM", Dictionary<string,object> ret = MakeRequest("ADDITEM",
new Dictionary<string,object> { new Dictionary<string,object> {
{ "AssetID", item.AssetID.ToString() }, { "AssetID", item.AssetID.ToString() },
@ -335,6 +337,8 @@ namespace OpenSim.Services.Connectors
public bool UpdateItem(InventoryItemBase item) public bool UpdateItem(InventoryItemBase item)
{ {
if (item.CreatorData == null)
item.CreatorData = String.Empty;
Dictionary<string,object> ret = MakeRequest("UPDATEITEM", Dictionary<string,object> ret = MakeRequest("UPDATEITEM",
new Dictionary<string,object> { new Dictionary<string,object> {
{ "AssetID", item.AssetID.ToString() }, { "AssetID", item.AssetID.ToString() },
@ -558,7 +562,10 @@ namespace OpenSim.Services.Connectors
item.InvType = int.Parse(data["InvType"].ToString()); item.InvType = int.Parse(data["InvType"].ToString());
item.Folder = new UUID(data["Folder"].ToString()); item.Folder = new UUID(data["Folder"].ToString());
item.CreatorId = data["CreatorId"].ToString(); item.CreatorId = data["CreatorId"].ToString();
item.CreatorData = data["CreatorData"].ToString(); if (data.ContainsKey("CreatorData"))
item.CreatorData = data["CreatorData"].ToString();
else
item.CreatorData = String.Empty;
item.Description = data["Description"].ToString(); item.Description = data["Description"].ToString();
item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); item.NextPermissions = uint.Parse(data["NextPermissions"].ToString());
item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString());