소스 검색

* Fix bug #36052, defaultencoding does not need to be freed

git-svn-id: trunk@42932 -
michael 6 년 전
부모
커밋
0bbe319d4c
1개의 변경된 파일2개의 추가작업 그리고 9개의 파일을 삭제
  1. 2 9
      packages/fcl-base/src/inifiles.pp

+ 2 - 9
packages/fcl-base/src/inifiles.pp

@@ -1381,17 +1381,10 @@ begin
       if FEncoding=nil then
         slLines.LoadFromFile(FFileName)
       else
-      begin
-        slLines.DefaultEncoding := FEncoding;
-        slLines.LoadFromFile(FFileName, nil);
-        if FEncoding <> slLines.Encoding then
         begin
-          if FOwnsEncoding then
-            FEncoding.Free;
-          FEncoding := slLines.Encoding;
-          FOwnsEncoding := not TEncoding.IsStandardEncoding(FEncoding);
+        slLines.DefaultEncoding := FEncoding; // TStrings clones the encoding.
+        slLines.LoadFromFile(FFileName, nil);
         end;
-      end;
       FillSectionList(slLines);
     finally
       slLines.Free;