From bbe04aab952d5b0ce1080141bdb2b52027165173 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 28 Sep 2012 01:50:21 +0100 Subject: [PATCH] Lock GDI+ portion og VectorRenderModule.GetDrawStringSize() to prevent concurrent thread use provoking mono crashes. Same rationale as commit 13690582. --- .../VectorRender/VectorRenderModule.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index c48a703ba2..d0802329c8 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -98,14 +98,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender public void GetDrawStringSize(string text, string fontName, int fontSize, out double xSize, out double ySize) { - using (Font myFont = new Font(fontName, fontSize)) + lock (this) { - SizeF stringSize = new SizeF(); - lock (m_graph) + using (Font myFont = new Font(fontName, fontSize)) { - stringSize = m_graph.MeasureString(text, myFont); - xSize = stringSize.Width; - ySize = stringSize.Height; + SizeF stringSize = new SizeF(); + + // XXX: This lock may be unnecessary. + lock (m_graph) + { + stringSize = m_graph.MeasureString(text, myFont); + xSize = stringSize.Width; + ySize = stringSize.Height; + } } } }