ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/client/FBOutputBlock.pas
(Generate patch)

Comparing ibx/trunk/fbintf/client/FBOutputBlock.pas (file contents):
Revision 144 by tony, Sat Feb 24 23:15:51 2018 UTC vs.
Revision 209 by tony, Wed Mar 14 12:48:51 2018 UTC

# Line 430 | Line 430 | end;
430   procedure TOutputBlockItem.SetString(out S: AnsiString; Buf: PByte;
431    Len: integer; CodePage: TSystemCodePage);
432   var rs: RawByteString;
433 +    i: integer;
434   begin
435 <  system.SetString(rs,PAnsiChar(Buf),len);
435 >  {There seems to be a memory manager problem with SetString that can cause
436 >   an unhandled exception at the end of a program if it is used to set the
437 >   string. Safer to copy characters one by one. Note that Setlength does
438 >   not work around the bug either.}
439 >  rs := '';
440 >  for i := 0 to len-1 do
441 >    rs := rs + PAnsiChar(buf+i)^;
442 > //  system.SetString(rs,PAnsiChar(Buf),len);
443    SetCodePage(rs,CodePage,false);
444    S := rs;
445   end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines