remove a potencial (and silly) deadlock; let other texture parameters changes trigger Changed.TEXTURE event

0.9.0.1-postfixes
UbitUmarov 2017-11-08 01:53:36 +00:00
parent 56d2db3a18
commit 8479658cd0
2 changed files with 46 additions and 27 deletions

View File

@ -358,7 +358,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = parts[i];
if(m_DeepEffectivePermsInvalid)
part.AggregateInnerPerms();
part.AggregatedInnerPermsForGroup();
owner &= part.AggregatedInnerOwnerPerms;
group &= part.AggregatedInnerGroupPerms;

View File

@ -2579,9 +2579,30 @@ namespace OpenSim.Region.Framework.Scenes
AggregatedInnerOwnerPerms = owner & mask;
AggregatedInnerGroupPerms = group & mask;
AggregatedInnerEveryonePerms = everyone & mask;
}
if(ParentGroup != null)
ParentGroup.InvalidateEffectivePerms();
}
// same as above but called during group Effective Permission validation
public void AggregatedInnerPermsForGroup()
{
// assuming child prims permissions masks are irrelevant on a linkset
// root part is handle at SOG since its masks are the sog masks
const uint mask = (uint)PermissionMask.AllEffective;
uint owner = mask;
uint group = mask;
uint everyone = mask;
lock(InnerPermsLock) // do we really need this?
{
if(Inventory != null)
Inventory.AggregateInnerPerms(ref owner, ref group, ref everyone);
AggregatedInnerOwnerPerms = owner & mask;
AggregatedInnerGroupPerms = group & mask;
AggregatedInnerEveryonePerms = everyone & mask;
}
}
public Vector3 GetGeometricCenter()
@ -3817,7 +3838,8 @@ namespace OpenSim.Region.Framework.Scenes
Byte[] buf = Shape.Textures.GetBytes();
Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
Color4 texcolor;
if (face >= 0 && face < GetNumberOfSides())
int nsides = GetNumberOfSides();
if (face >= 0 && face < nsides)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.R = clippedColor.X;
@ -3833,7 +3855,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else if (face == ALL_SIDES)
{
for (uint i = 0; i < GetNumberOfSides(); i++)
for (uint i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@ -5138,20 +5160,20 @@ namespace OpenSim.Region.Framework.Scenes
Changed changeFlags = 0;
Primitive.TextureEntryFace fallbackNewFace = newTex.DefaultTexture;
Primitive.TextureEntryFace fallbackOldFace = oldTex.DefaultTexture;
Primitive.TextureEntryFace defaultNewFace = newTex.DefaultTexture;
Primitive.TextureEntryFace defaultOldFace = oldTex.DefaultTexture;
// On Incoming packets, sometimes newText.DefaultTexture is null. The assumption is that all
// other prim-sides are set, but apparently that's not always the case. Lets assume packet/data corruption at this point.
if (fallbackNewFace == null)
if (defaultNewFace == null)
{
fallbackNewFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
newTex.DefaultTexture = fallbackNewFace;
defaultNewFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
newTex.DefaultTexture = defaultNewFace;
}
if (fallbackOldFace == null)
if (defaultOldFace == null)
{
fallbackOldFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
oldTex.DefaultTexture = fallbackOldFace;
defaultOldFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
oldTex.DefaultTexture = defaultOldFace;
}
// Materials capable viewers can send a ObjectImage packet
@ -5161,13 +5183,11 @@ namespace OpenSim.Region.Framework.Scenes
// we should ignore any changes and not update Shape.TextureEntry
bool otherFieldsChanged = false;
for (int i = 0 ; i < GetNumberOfSides(); i++)
int nsides = GetNumberOfSides();
for (int i = 0 ; i < nsides; i++)
{
Primitive.TextureEntryFace newFace = newTex.DefaultTexture;
Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture;
Primitive.TextureEntryFace newFace = defaultNewFace;
Primitive.TextureEntryFace oldFace = defaultOldFace;
if (oldTex.FaceTextures[i] != null)
oldFace = oldTex.FaceTextures[i];
if (newTex.FaceTextures[i] != null)
@ -5202,18 +5222,17 @@ namespace OpenSim.Region.Framework.Scenes
if (oldFace.Rotation != newFace.Rotation) otherFieldsChanged = true;
if (oldFace.Shiny != newFace.Shiny) otherFieldsChanged = true;
if (oldFace.TexMapType != newFace.TexMapType) otherFieldsChanged = true;
if(otherFieldsChanged)
changeFlags |= Changed.TEXTURE;
}
}
if (changeFlags != 0 || otherFieldsChanged)
{
m_shape.TextureEntry = newTex.GetBytes();
if (changeFlags != 0)
TriggerScriptChangedEvent(changeFlags);
ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate();
}
}
internal void UpdatePhysicsSubscribedEvents()
{