View Issue Details

IDProjectCategoryView StatusLast Update
0038372FPCFCLpublic2021-01-20 10:22
ReporterYuriy Kopnin Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionunable to reproduce 
Product Version3.2.0 
Summary0038372: TStrings.SaveToStream
DescriptionHello.

When switching to FPC 3.2 and Lazarus 2.0.10, all TStrings.SaveToStream(S: TSTream) do not work.
Procedure TStrings.SaveToStream(Stream: TStream);
begin
  SaveToStream(Stream,False);
end;
then not works.

If you fix:
Procedure TStrings.SaveToStream(Stream: TStream);
begin
  SaveToStream(Stream,True);
end;
then works.

Same with LoadFromFile, LoadFromStream
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

Michael Van Canneyt

2021-01-19 13:02

administrator   ~0128407

It works fine here.

{$mode objfpc}
uses classes;

Var
  F : TFileStream;

begin
  F:=nil;
  With TStringList.Create do
    try
      Add('a');
      Add('b');
      F:=TFileStream.Create('a.txt',fmCreate);
      SaveToStream(F);
    Finally
      Free;
      F.Free;
    end;
end.

Creates a correct file.

Please create a sample program that demonstrates the issue, and explain what you expect to see.

Yuriy Kopnin

2021-01-20 07:20

reporter   ~0128444

Last edited: 2021-01-20 08:13

View 9 revisions

I tried to create a test application, everything works in it. In older projects, Tstrings.SaveToStream (S: TStream) issues Access Violation, while there are no errors at the gas station 3.0.4. The error disappears if I explicitly specify DefaultEncoding:
var SL: TSTringList;
begin
  SL := TSTringList.Create;
  try
     SL.DefaultEncoding := SL.Encoding.UTF8; //SL.DefaultEncoding = nil !!!!!!!!!
     SL.SaveToStream(MyStream); //if you specify DefaultEncoding there are no errors
  finally
    SL.Free;
  end;
end;

For some reason, here SL.DefaultEncoding = nil

Yuriy Kopnin

2021-01-20 10:17

reporter   ~0128445

I solved the problem, the error disappeared, the topic can be closed.

Michael Van Canneyt

2021-01-20 10:22

administrator   ~0128447

Closing as per reporter's request

Issue History

Date Modified Username Field Change
2021-01-19 12:07 Yuriy Kopnin New Issue
2021-01-19 12:58 Michael Van Canneyt Assigned To => Michael Van Canneyt
2021-01-19 12:58 Michael Van Canneyt Status new => assigned
2021-01-19 13:02 Michael Van Canneyt Status assigned => feedback
2021-01-19 13:02 Michael Van Canneyt FPCTarget => -
2021-01-19 13:02 Michael Van Canneyt Note Added: 0128407
2021-01-20 07:20 Yuriy Kopnin Note Added: 0128444
2021-01-20 07:20 Yuriy Kopnin Status feedback => assigned
2021-01-20 07:21 Yuriy Kopnin Note Edited: 0128444 View Revisions
2021-01-20 07:21 Yuriy Kopnin Note Edited: 0128444 View Revisions
2021-01-20 07:28 Yuriy Kopnin Note Edited: 0128444 View Revisions
2021-01-20 07:30 Yuriy Kopnin Note Edited: 0128444 View Revisions
2021-01-20 07:30 Yuriy Kopnin Note Edited: 0128444 View Revisions
2021-01-20 07:31 Yuriy Kopnin Note Edited: 0128444 View Revisions
2021-01-20 08:09 Yuriy Kopnin Note Edited: 0128444 View Revisions
2021-01-20 08:13 Yuriy Kopnin Note Edited: 0128444 View Revisions
2021-01-20 10:17 Yuriy Kopnin Note Added: 0128445
2021-01-20 10:22 Michael Van Canneyt Status assigned => resolved
2021-01-20 10:22 Michael Van Canneyt Resolution open => unable to reproduce
2021-01-20 10:22 Michael Van Canneyt Note Added: 0128447