Work around access violations in SynEdit, fixes issue #2358.

This commit is contained in:
Ansgar Becker
2011-08-16 17:44:19 +00:00
parent a170149801
commit fe30837321
2 changed files with 7 additions and 3 deletions

View File

@@ -2834,7 +2834,7 @@ begin
for i := 1 to Length(S) do
begin
inc(j);
CountOfAvgGlyphs := Ceil(fTextDrawer.TextWidth(S[i]) / fCharWidth);
CountOfAvgGlyphs := Ceil(fTextDrawer.TextWidth(S[i]) / Max(fCharWidth,1));
if j + CountOfAvgGlyphs > Length(Result) then
SetLength(Result, Length(Result) + 128);

View File

@@ -935,8 +935,12 @@ procedure TheTextDrawer.ExtTextOut(X, Y: Integer; Options: TTextOutOptions;
end;
begin
InitETODist(GetCharWidth);
AdjustLastCharWidthAndRect;
try
InitETODist(GetCharWidth);
AdjustLastCharWidthAndRect;
except
// Suppress error in threaded applications
end;
UniversalExtTextOut(FDC, X, Y, Options, ARect, Text, Length, FETODist);
end;