Fix access violation when using ASCIIencoding, by turning it from a SingleTon into a new instance each time we call GetEncodingByName. Probably introduces a memory leak. The encoding object is freed when using in a TStringStream context which is freed after usage. See exportgrid unit.

This commit is contained in:
Ansgar Becker
2012-11-17 08:48:21 +00:00
parent 5958d7102b
commit b6a18114f4
2 changed files with 6 additions and 6 deletions

View File

@ -327,7 +327,6 @@ type
var
AppSettings: TAppSettings;
MutexHandle: THandle = 0;
ASCIIEncoding: TEncoding;
implementation
@ -2449,7 +2448,7 @@ begin
Result := '';
if Encoding = TEncoding.Default then
Result := 'Windows-'+IntToStr(GetACP)
else if Encoding = ASCIIEncoding then
else if Encoding.CodePage = 437 then
Result := 'ascii'
else if Encoding = TEncoding.Unicode then
Result := 'utf-16le'