From 6b7625a56b18901d1004505e4b8695d511603528 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 7 Mar 2014 01:23:19 +0000 Subject: [PATCH] Only auto-create a land parcel when there is none in a specified tile if there is more than 1 existing land parcel. This is because there are still issues with bad parcels being generated in http://opensimulator.org/mantis/view.php?id=7035 Theorizing now that it's possible that something is calling GetParcel() before any parcel data has been loaded from persistence. --- .../CoreModules/World/Land/LandManagementModule.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index de40685742..05f9f26e59 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -874,6 +874,10 @@ namespace OpenSim.Region.CoreModules.World.Land // This sometimes happens when terrain is resized. if (m_landList.Count == 1) { + m_log.DebugFormat( + "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", + LogHeader, x, y, m_scene.Name); + int onlyParcelID = 0; ILandObject onlyLandObject = null; foreach (KeyValuePair kvp in m_landList) @@ -892,8 +896,12 @@ namespace OpenSim.Region.CoreModules.World.Land onlyLandObject.LandBitmap = CreateBitmapForID(onlyParcelID); landID = onlyParcelID; } - else + else if (m_landList.Count > 1) { + m_log.DebugFormat( + "[{0}]: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", + LogHeader, x, y, m_scene.Name); + // There are several other parcels so we must create a new one for the unassigned space ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); // Claim all the unclaimed "0" ids @@ -907,6 +915,10 @@ namespace OpenSim.Region.CoreModules.World.Land landID = m_lastLandLocalID; } + + // XXX: We're not currently doing anything if there are no parcels, as this might indicate a race + // condition where this method is being called before land data is loaded. May need to address + // this in another way. } ret = m_landList[landID];