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

Same rationale as commit 13690582.
connector_plugin
Justin Clark-Casey (justincc) 2012-09-28 01:50:21 +01:00
parent 2bf42f30af
commit 3db10fdbef
1 changed files with 11 additions and 6 deletions

View File

@ -112,14 +112,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;
}
}
}
}