diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index a6d62ce0c0..018c190133 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -308,36 +308,44 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender try { - if (alpha == 256) - bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); - else - bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); - - graph = Graphics.FromImage(bitmap); - - // this is really just to save people filling the - // background color in their scripts, only do when fully opaque - if (alpha >= 255) + // XXX: In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously, + // the native malloc heap can become corrupted, possibly due to a double free(). This may be due to + // bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were + // seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed + // under lock. + lock (this) { - using (SolidBrush bgFillBrush = new SolidBrush(bgColor)) - { - graph.FillRectangle(bgFillBrush, 0, 0, width, height); - } - } + if (alpha == 256) + bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); + else + bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); - for (int w = 0; w < bitmap.Width; w++) - { - if (alpha <= 255) + graph = Graphics.FromImage(bitmap); + + // this is really just to save people filling the + // background color in their scripts, only do when fully opaque + if (alpha >= 255) { - for (int h = 0; h < bitmap.Height; h++) + using (SolidBrush bgFillBrush = new SolidBrush(bgColor)) { - bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); + graph.FillRectangle(bgFillBrush, 0, 0, width, height); } } + + for (int w = 0; w < bitmap.Width; w++) + { + if (alpha <= 255) + { + for (int h = 0; h < bitmap.Height; h++) + { + bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); + } + } + } + + GDIDraw(data, graph, altDataDelim); } - GDIDraw(data, graph, altDataDelim); - byte[] imageJ2000 = new byte[0]; try @@ -355,11 +363,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender } finally { - if (graph != null) - graph.Dispose(); - - if (bitmap != null) - bitmap.Dispose(); + // XXX: In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously, + // the native malloc heap can become corrupted, possibly due to a double free(). This may be due to + // bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were + // seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed + // under lock. + lock (this) + { + if (graph != null) + graph.Dispose(); + + if (bitmap != null) + bitmap.Dispose(); + } } } diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 14c1a3947e..a2f09507ef 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -85,13 +85,15 @@ namespace OpenSim.Region.CoreModules.World.Sound dis = 0; } + float thisSpGain; + // Scale by distance if (radius == 0) - gain = (float)((double)gain * ((100.0 - dis) / 100.0)); + thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); else - gain = (float)((double)gain * ((radius - dis) / radius)); + thisSpGain = (float)((double)gain * ((radius - dis) / radius)); - sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); + sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); }); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8140416b80..0d275f7424 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1341,11 +1341,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api scale.y = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.y)); scale.z = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.z)); } - - // Next we clamp the scale to the non-physical min/max - scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x)); - scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y)); - scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z)); + else + { + // If not physical, then we clamp the scale to the non-physical min/max + scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x)); + scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y)); + scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z)); + } Vector3 tmp = part.Scale; tmp.X = (float)scale.x; diff --git a/bin/lib32/BulletSim.dll b/bin/lib32/BulletSim.dll index cc55f00919..ce0dd9d636 100755 Binary files a/bin/lib32/BulletSim.dll and b/bin/lib32/BulletSim.dll differ diff --git a/bin/lib32/libBulletSim.so b/bin/lib32/libBulletSim.so index 26ad52ba23..d2d65408af 100755 Binary files a/bin/lib32/libBulletSim.so and b/bin/lib32/libBulletSim.so differ diff --git a/bin/lib64/BulletSim.dll b/bin/lib64/BulletSim.dll index 94dae95849..67d3f1c397 100755 Binary files a/bin/lib64/BulletSim.dll and b/bin/lib64/BulletSim.dll differ diff --git a/bin/lib64/libBulletSim.so b/bin/lib64/libBulletSim.so index 52e9960274..9a5c1712f3 100755 Binary files a/bin/lib64/libBulletSim.so and b/bin/lib64/libBulletSim.so differ