dispose() computes its argument twice
Original Reporter info from Mantis: runewalsh
-
Reporter name:
Original Reporter info from Mantis: runewalsh
- Reporter name:
Description:
It looks like when dispose()'ing managed type, such as AnsiString, dispose(), not being a real function, splits itself into Finalize() and FreeMem(), and computes its argument twice regardless of side effects.
Steps to reproduce:
{$mode objfpc} {$h+}
function CreateString: pString;
begin
writeln('Creating a string');
new(result);
end;
begin
dispose(CreateString); // prints “Creating a string” twice
end.
Additional information:
In accordance with my hypothesis, this bug does not manifests itself with unmanaged types.