[fpc-devel] ref count issue with out param
Martin Frb
lazarus at mfriebe.de
Sat Jun 13 15:15:01 CEST 2015
On 13/06/2015 10:05, Jonas Maebe wrote:
> Martin Frb wrote:
>> ebx is a temp copy of s1, but then f1 becomes nil, and ebx points to
>> freed memory.
>
> It's because "out" finalises on the caller side (due to its COM
> origin, I guess) while value parameters get their reference count
> increased on the callee side (for efficiency reasons, I guess). This
> is all Delphi-compatible.
I dont have Delphi, but
http://forum.lazarus.freepascal.org/index.php/topic,28740.msg180201.html#msg180201
says Delphi handles it different.
More information about the fpc-devel
mailing list