mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
- Fixed a bug where a thread unsafe string length measuring method could cause a crash. Fixes #275.
This commit is contained in:
parent
2516b97cee
commit
363a07c609
1 changed files with 19 additions and 2 deletions
|
@ -4488,12 +4488,29 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
public SizeF MeasureString(string text, Font font)
|
||||
{
|
||||
return graphics.MeasureString(text, font);
|
||||
SizeF length;
|
||||
|
||||
// Be thread safe
|
||||
lock(graphics)
|
||||
{
|
||||
length = graphics.MeasureString(text, font);
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
public SizeF MeasureString(string text, Font font, int width, StringFormat format)
|
||||
{
|
||||
return graphics.MeasureString(text, font, width, format);
|
||||
SizeF length;
|
||||
|
||||
// Be thread safe
|
||||
lock (graphics)
|
||||
{
|
||||
|
||||
length = graphics.MeasureString(text, font, width, format);
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue