[fpc-devel] ref count issue with out param
Martin Frb
lazarus at mfriebe.de
Sat Jun 13 14:21:19 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.
Ok. that's why I asked before deciding if reporting.
I knew that the value of s1 (as in empty versus the last strings
content) was more or less unpredictable.
But I thought that ref-counting was save, except for "const". This is
why I asked.
More information about the fpc-devel
mailing list