diff options
author | Justin Clark-Casey (justincc) | 2011-09-15 18:13:36 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-09-15 18:13:36 +0100 |
commit | 42f1b88eb2492f8d218526c1b30ac027a65d67f3 (patch) | |
tree | 50e2f37c8d58ca4f520df1f3e9d2ef42361baa92 /OpenSim/Region | |
parent | Don't try and delete attachments for child agent close (diff) | |
download | opensim-SC_OLD-42f1b88eb2492f8d218526c1b30ac027a65d67f3.zip opensim-SC_OLD-42f1b88eb2492f8d218526c1b30ac027a65d67f3.tar.gz opensim-SC_OLD-42f1b88eb2492f8d218526c1b30ac027a65d67f3.tar.bz2 opensim-SC_OLD-42f1b88eb2492f8d218526c1b30ac027a65d67f3.tar.xz |
If a prim inventory becomes empty through deletion, send an empty xfer file name rather than one that references a metadata file containing only the folder object.
If we do this, then viewer 3 crashes when we try and rez a script directly in an attachment's prim inventory.
Sending an empty file name was already being done if the prim's inventory had never been touched.
Now we always do that if there are no items in that inventory.
Hopefully addresses the remaining point in http://opensimulator.org/mantis/view.php?id=5644
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 63 |
1 files changed, 43 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 57adda7..59ac30d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -784,6 +784,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
784 | 784 | ||
785 | private bool CreateInventoryFile() | 785 | private bool CreateInventoryFile() |
786 | { | 786 | { |
787 | // m_log.DebugFormat( | ||
788 | // "[PRIM INVENTORY]: Creating inventory file for {0} {1} {2}, serial {3}", | ||
789 | // m_part.Name, m_part.UUID, m_part.LocalId, m_inventorySerial); | ||
790 | |||
787 | if (m_inventoryFileName == String.Empty || | 791 | if (m_inventoryFileName == String.Empty || |
788 | m_inventoryFileNameSerial < m_inventorySerial) | 792 | m_inventoryFileNameSerial < m_inventorySerial) |
789 | { | 793 | { |
@@ -797,6 +801,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
797 | { | 801 | { |
798 | foreach (TaskInventoryItem item in m_items.Values) | 802 | foreach (TaskInventoryItem item in m_items.Values) |
799 | { | 803 | { |
804 | // m_log.DebugFormat( | ||
805 | // "[PRIM INVENTORY]: Adding item {0} {1} for serial {2} on prim {3} {4} {5}", | ||
806 | // item.Name, item.ItemID, m_inventorySerial, m_part.Name, m_part.UUID, m_part.LocalId); | ||
807 | |||
800 | UUID ownerID = item.OwnerID; | 808 | UUID ownerID = item.OwnerID; |
801 | uint everyoneMask = 0; | 809 | uint everyoneMask = 0; |
802 | uint baseMask = item.BasePermissions; | 810 | uint baseMask = item.BasePermissions; |
@@ -856,28 +864,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
856 | /// <param name="xferManager"></param> | 864 | /// <param name="xferManager"></param> |
857 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) | 865 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) |
858 | { | 866 | { |
859 | CreateInventoryFile(); | 867 | lock (m_items) |
860 | |||
861 | if (m_inventorySerial == 0) // No inventory | ||
862 | { | 868 | { |
863 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); | 869 | CreateInventoryFile(); |
864 | return; | ||
865 | } | ||
866 | |||
867 | // In principle, we should only do the rest if the inventory changed; | ||
868 | // by sending m_inventorySerial to the client, it ought to know | ||
869 | // that nothing changed and that it doesn't need to request the file. | ||
870 | // Unfortunately, it doesn't look like the client optimizes this; | ||
871 | // the client seems to always come back and request the Xfer, | ||
872 | // no matter what value m_inventorySerial has. | ||
873 | 870 | ||
874 | if (m_inventoryFileData.Length > 2) | 871 | // Don't send a inventory xfer name if there are no items. Doing so causes viewer 3 to crash when rezzing |
875 | // Add the file for Xfer | 872 | // a new script if any previous deletion has left the prim inventory empty. |
876 | xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); | 873 | if (m_items.Count == 0) // No inventory |
877 | 874 | { | |
878 | // Tell the client we're ready to Xfer the file | 875 | // m_log.DebugFormat( |
879 | client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, | 876 | // "[PRIM INVENTORY]: Not sending inventory data for part {0} {1} {2} for {3} since no items", |
880 | Util.StringToBytes256(m_inventoryFileName)); | 877 | // m_part.Name, m_part.LocalId, m_part.UUID, client.Name); |
878 | |||
879 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); | ||
880 | return; | ||
881 | } | ||
882 | |||
883 | // In principle, we should only do the rest if the inventory changed; | ||
884 | // by sending m_inventorySerial to the client, it ought to know | ||
885 | // that nothing changed and that it doesn't need to request the file. | ||
886 | // Unfortunately, it doesn't look like the client optimizes this; | ||
887 | // the client seems to always come back and request the Xfer, | ||
888 | // no matter what value m_inventorySerial has. | ||
889 | // FIXME: Could probably be > 0 here rather than > 2 | ||
890 | if (m_inventoryFileData.Length > 2) | ||
891 | { | ||
892 | // Add the file for Xfer | ||
893 | // m_log.DebugFormat( | ||
894 | // "[PRIM INVENTORY]: Adding inventory file {0} (length {1}) for transfer on {2} {3} {4}", | ||
895 | // m_inventoryFileName, m_inventoryFileData.Length, m_part.Name, m_part.UUID, m_part.LocalId); | ||
896 | |||
897 | xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); | ||
898 | } | ||
899 | |||
900 | // Tell the client we're ready to Xfer the file | ||
901 | client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, | ||
902 | Util.StringToBytes256(m_inventoryFileName)); | ||
903 | } | ||
881 | } | 904 | } |
882 | 905 | ||
883 | /// <summary> | 906 | /// <summary> |