Fix for crash when creating textblock objects and drawing on different thead crashing.
This commit is contained in:
Родитель
261f9e6c7e
Коммит
e7cda997ea
|
@ -1038,14 +1038,15 @@ namespace Topten.RichTextKit
|
||||||
return _textAlignment;
|
return _textAlignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the shared Bidi algo instance
|
|
||||||
Bidi _bidi = Bidi.Instance.Value;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Split into runs based on directionality and style switch points
|
/// Split into runs based on directionality and style switch points
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void BuildFontRuns()
|
void BuildFontRuns()
|
||||||
{
|
{
|
||||||
|
// Use the shared Bidi algo instance
|
||||||
|
Bidi bidi = Bidi.Instance.Value;
|
||||||
|
|
||||||
var originalLength = _codePoints.Length;
|
var originalLength = _codePoints.Length;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1078,12 +1079,12 @@ namespace Topten.RichTextKit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process bidi
|
// Process bidi
|
||||||
_bidi.Process(_bidiData);
|
bidi.Process(_bidiData);
|
||||||
|
|
||||||
var resolvedLevels = _bidi.ResolvedLevels;
|
var resolvedLevels = bidi.ResolvedLevels;
|
||||||
|
|
||||||
// Get resolved direction
|
// Get resolved direction
|
||||||
_resolvedBaseDirection = (TextDirection)_bidi.ResolvedParagraphEmbeddingLevel;
|
_resolvedBaseDirection = (TextDirection)bidi.ResolvedParagraphEmbeddingLevel;
|
||||||
|
|
||||||
// Now process the embedded runs
|
// Now process the embedded runs
|
||||||
if (_hasTextDirectionOverrides)
|
if (_hasTextDirectionOverrides)
|
||||||
|
@ -1111,7 +1112,7 @@ namespace Topten.RichTextKit
|
||||||
var levels = _bidiData.GetTempLevelBuffer(sr.Length);
|
var levels = _bidiData.GetTempLevelBuffer(sr.Length);
|
||||||
|
|
||||||
// Process this style run
|
// Process this style run
|
||||||
_bidi.Process(types, pbts, pbvs, (sbyte)sr.Style.TextDirection, _bidiData.HasBrackets, _bidiData.HasEmbeddings, _bidiData.HasIsolates, levels);
|
bidi.Process(types, pbts, pbvs, (sbyte)sr.Style.TextDirection, _bidiData.HasBrackets, _bidiData.HasEmbeddings, _bidiData.HasIsolates, levels);
|
||||||
|
|
||||||
// Copy result levels back to the full level set
|
// Copy result levels back to the full level set
|
||||||
resolvedLevels.SubSlice(sr.Start, sr.Length).Set(levels);
|
resolvedLevels.SubSlice(sr.Start, sr.Length).Set(levels);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче