You are not logged in.
Pages: 1
Hi,
We are considering to upgrade from 10.3.1 to 10.4.x
Is TAutoFree working in 10.4 as expected?
Offline
unassigned interface returned as function parameter is freeed much earlier not in end of method
For example
https://quality.embarcadero.com/browse/RSP-30050
Offline
Offline
Okay - haven't yet installed 10.4... Probably haveto and test
Offline
This early release "new feature" breaks the TAutoFree and TSQLRecord.AutoFree expectations.
I have documented it properly on mORMot 2 to state that it should perhaps not be used any more for new projects, since it is also not supported by Delphi.
Also TSynLog.Enter() returns a ISynLog which should be assigned to a local variable...
I have added an interface method call for Delphi 10.4+ on mORMot2, trying to circumvent the TAutoFree.One() problem...
Check https://github.com/synopse/mORMot2/comm … 183d77202b
Any additional feedback is welcome!
Offline
I found the following change in the source code.
procedure TAutoFree.Another(var localVariable; obj: TObject);
...
- for i := high(fObjectList) downto 0 do // release FILO
+ for i := length(fObjectList) - 1 downto 0 do // release FILO
Arnaud, would it be possible to explain me the reason for this? Is there anything to keep in mind when using High()?
With best regards
Thomas
Offline
@ab,
Please consider the another alternative to fix it in the recent Delphi compilers with Managed Record inside TAutoFree.
One of the benefit from-the-box is reverse auto-invocation order of Finalize() in routines epilogue.
Offline
Offline
Offline
Please consider the another alternative to fix it in the recent Delphi compilers with Managed Record inside TAutoFree.
Will not work - see this code:
type
autofree = record
class operator finalize(var value: autofree);
end;
class operator autofree.finalize(var value: autofree);
begin
Writeln('finalize');
end;
function get: autofree;
begin
end;
procedure Main(const i: Integer);
begin
if i = 42 then
get;
Writeln('end');
end;
begin
Main(42);
Readln;
end.
Will write 'finalize' before 'end'
Offline
Yeah, but it was so usefull not to generate all this try ... finally nesting, all libraries and all sources with IAutoFree now must be rewritten.
Especially for TSQLRecord and it's ancesstors
Offline
Pages: 1