Lock GDI+ portion og VectorRenderModule.GetDrawStringSize() to prevent concurrent thread use provoking mono crashes.

Same rationale as commit 13690582.
0.7.4-post-fixes
Justin Clark-Casey (justincc) 2012-09-28 01:50:21 +01:00
parent c27a158961
commit bbe04aab95
1 changed files with 11 additions and 6 deletions

View File

@ -97,10 +97,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
public void GetDrawStringSize(string text, string fontName, int fontSize, public void GetDrawStringSize(string text, string fontName, int fontSize,
out double xSize, out double ySize) out double xSize, out double ySize)
{
lock (this)
{ {
using (Font myFont = new Font(fontName, fontSize)) using (Font myFont = new Font(fontName, fontSize))
{ {
SizeF stringSize = new SizeF(); SizeF stringSize = new SizeF();
// XXX: This lock may be unnecessary.
lock (m_graph) lock (m_graph)
{ {
stringSize = m_graph.MeasureString(text, myFont); stringSize = m_graph.MeasureString(text, myFont);
@ -109,6 +113,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
} }
} }
} }
}
#endregion #endregion