PDA

View Full Version : Strange Bug with TFileStream on Lazarus MacOS



wagenheimer
24-04-2011, 08:34 PM
Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone);
try
LoadFromStream(Stream);
finally
Stream.Free;
end;


I'm getting Access Violations on Stream.Free on Lazarus 0.9.31 and FPC 2.4.2, on MacOS. The same code works on Delphi 2010.

If I remove Stream.Free it works, but the file remains open.

Has anyone gone through something similar?

wagenheimer
24-04-2011, 11:17 PM
{$IFDEF FPC}
{$packset 1}
{$ENDIF}


This fixed the problem! I don't know why but SizeOf(Set) was returning 4 to me in FPC but 1 in Delphi.

paul_nicholls
27-04-2011, 12:23 AM
I'm glad you found the problem :)

It might help someone else...

cheers,
Paul