aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-07 16:30:29 +0000
committerJustin Clarke Casey2008-04-07 16:30:29 +0000
commit2caea75aa8ec1b003e7866bba2109c72df2a10c2 (patch)
tree4e2d12141961cec9088aaaa0da87a13eb1dd4102
parentadd some error messages for abuse of our IInventoryData interface (diff)
downloadopensim-SC-2caea75aa8ec1b003e7866bba2109c72df2a10c2.zip
opensim-SC-2caea75aa8ec1b003e7866bba2109c72df2a10c2.tar.gz
opensim-SC-2caea75aa8ec1b003e7866bba2109c72df2a10c2.tar.bz2
opensim-SC-2caea75aa8ec1b003e7866bba2109c72df2a10c2.tar.xz
* Okay you can put down your pitchforks - this patch should fix rezzing of items (with inventory) on Windows
* Now properly dealing with prims which don't contain items - thanks to thomas for the patch which gave insight into this situation * Also, an xml exception no longer crahes the client session * Leaving in debugging lines in case there are further problems * Not yet tested on Linux, though I'm just about to.
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs44
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs62
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs1
3 files changed, 53 insertions, 54 deletions
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 91c952d..c9c8054 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -67,41 +67,31 @@ namespace OpenSim.Framework
67 // see IXmlSerializable 67 // see IXmlSerializable
68 public void ReadXml(XmlReader reader) 68 public void ReadXml(XmlReader reader)
69 { 69 {
70 m_log.DebugFormat( 70 m_log.DebugFormat("[TASK INVENTORY]: ReadXml current node before actions, {0}", reader.Name);
71 "[TASK INVENTORY]: Initial task inventory deserialization CanDeserialize() call was {0}", 71
72 tiiSerializer.CanDeserialize(reader)); 72 if (!reader.IsEmptyElement)
73
74 reader.Read();
75 while (tiiSerializer.CanDeserialize(reader))
76 { 73 {
77 TaskInventoryItem item = (TaskInventoryItem)tiiSerializer.Deserialize(reader); 74 reader.Read();
78 Add(item.ItemID, item); 75 while (tiiSerializer.CanDeserialize(reader))
76 {
77 TaskInventoryItem item = (TaskInventoryItem)tiiSerializer.Deserialize(reader);
78 Add(item.ItemID, item);
79
80 m_log.DebugFormat("[TASK INVENTORY]: Instanted prim item {0}, {1} from xml", item.Name, item.ItemID);
81 }
79 82
80// m_log.DebugFormat("[TASK INVENTORY]: Instanted prim item {0}, {1} from xml", item.Name, item.ItemID); 83 m_log.DebugFormat("[TASK INVENTORY]: Instantiated {0} prim items in total from xml", Count);
84 }
85 else
86 {
87 m_log.DebugFormat("[TASK INVENTORY]: Skipping empty element {0}", reader.Name);
81 } 88 }
82
83// m_log.DebugFormat("[TASK INVENTORY]: Instantiated {0} prim items in total from xml", Count);
84 89
85 // For some .net implementations, this last read is necessary so that we advance beyond the end tag 90 // For some .net implementations, this last read is necessary so that we advance beyond the end tag
86 // of the element wrapping this object so that the rest of the serialization can complete normally. 91 // of the element wrapping this object so that the rest of the serialization can complete normally.
87 reader.Read(); 92 reader.Read();
88 93
89// m_log.DebugFormat("[TASK INVENTORY]: Current node {0}", reader.Name); 94 m_log.DebugFormat("[TASK INVENTORY]: ReadXml Current node after actions, {0}", reader.Name);
90
91// reader.Read();
92// while (reader.Name.Equals("TaskInventoryItem"))
93// {
94// TaskInventoryItem item = (TaskInventoryItem)tiiSerializer.Deserialize(reader);
95// Add(item.ItemID, item);
96// }
97
98// ICollection<TaskInventoryItem> items
99// = (ICollection<TaskInventoryItem>)tiiSerializer.Deserialize(reader);
100//
101// foreach (TaskInventoryItem item in items)
102// {
103// Add(item.ItemID, item);
104// }
105 } 95 }
106 96
107 // see IXmlSerializable 97 // see IXmlSerializable
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index e2ba681..38c7e45 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -296,36 +296,46 @@ namespace OpenSim.Region.Environment.Scenes
296 296
297 StringReader sr = new StringReader(xmlData); 297 StringReader sr = new StringReader(xmlData);
298 XmlTextReader reader = new XmlTextReader(sr); 298 XmlTextReader reader = new XmlTextReader(sr);
299 reader.Read(); 299 try
300 reader.ReadStartElement("SceneObjectGroup");
301 reader.ReadStartElement("RootPart");
302 m_rootPart = SceneObjectPart.FromXml(reader);
303 AddPart(m_rootPart);
304
305// m_log.DebugFormat("[SCENE OBJECT GROUP]: Current node {0}", reader.Name);
306
307 reader.ReadEndElement();
308
309 while (reader.Read())
310 { 300 {
311 switch (reader.NodeType) 301 reader.Read();
302 reader.ReadStartElement("SceneObjectGroup");
303 reader.ReadStartElement("RootPart");
304 m_rootPart = SceneObjectPart.FromXml(reader);
305 AddPart(m_rootPart);
306
307 m_log.DebugFormat("[SCENE OBJECT GROUP]: Current node {0}", reader.Name);
308
309 reader.ReadEndElement();
310
311 while (reader.Read())
312 { 312 {
313 case XmlNodeType.Element: 313 switch (reader.NodeType)
314 if (reader.Name == "Part") 314 {
315 { 315 case XmlNodeType.Element:
316 reader.Read(); 316 if (reader.Name == "Part")
317 SceneObjectPart part = SceneObjectPart.FromXml(reader); 317 {
318 part.LocalId = m_scene.PrimIDAllocate(); 318 reader.Read();
319 AddPart(part); 319 SceneObjectPart part = SceneObjectPart.FromXml(reader);
320 part.RegionHandle = m_regionHandle; 320 part.LocalId = m_scene.PrimIDAllocate();
321 321 AddPart(part);
322 part.TrimPermissions(); 322 part.RegionHandle = m_regionHandle;
323 } 323
324 break; 324 part.TrimPermissions();
325 case XmlNodeType.EndElement: 325 }
326 break; 326 break;
327 case XmlNodeType.EndElement:
328 break;
329 }
327 } 330 }
328 } 331 }
332 catch (XmlException e)
333 {
334 m_log.ErrorFormat("[SCENE OBJECT GROUP]: Deserialization of following xml failed, {0}", xmlData);
335
336 // Let's see if carrying on does anything for us
337 }
338
329 reader.Close(); 339 reader.Close();
330 sr.Close(); 340 sr.Close();
331 341
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 395c8c6..16da516 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -77,7 +77,6 @@ namespace OpenSim.Region.Environment.Scenes
77 /// </summary> 77 /// </summary>
78 protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary(); 78 protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary();
79 79
80 [XmlIgnore]
81 public TaskInventoryDictionary TaskInventory 80 public TaskInventoryDictionary TaskInventory
82 { 81 {
83 get { return m_taskInventory; } 82 get { return m_taskInventory; }