Re: [fpc-devel] Reference counting interface objects

2014-10-16 Thread Jonas Maebe
On 16 Oct 2014, at 16:43, Adriaan van Os wrote: Jonas Maebe wrote: No, it won't: 1) if the external code expects it to be "out" and you declare it as "var": the caller will decrease the reference count and the ppEvent that you get will have as initial value "nil". You can just assign to

Re: [fpc-devel] Reference counting interface objects

2014-10-16 Thread Adriaan van Os
Jonas Maebe wrote: No, it won't: 1) if the external code expects it to be "out" and you declare it as "var": the caller will decrease the reference count and the ppEvent that you get will have as initial value "nil". You can just assign to it like normal. 2) if the external code expects it to

Re: [fpc-devel] Reference counting interface objects

2014-10-16 Thread Jonas Maebe
On 16 Oct 2014, at 15:02, Adriaan van Os wrote: Jonas Maebe wrote: Nothing ever needs to be manually released, regardless of whether it's a VAR or OUT parameter. That's the whole point of automatic reference counting) I agree for pure Pascal code, where a parameter can be OUT or VAR and

Re: [fpc-devel] Reference counting interface objects

2014-10-16 Thread Adriaan van Os
Jonas Maebe wrote: On 16 Oct 2014, at 12:35, Adriaan van Os wrote: Now, it seems (correct me if I am wrong) that theEvent doesn't need to be manually released, because it has been declared as an OUT parameter rather than a VAR parameter. So, if this is true, this information is crucial when

Re: [fpc-devel] Reference counting interface objects

2014-10-16 Thread Jonas Maebe
On 16 Oct 2014, at 12:35, Adriaan van Os wrote: Now, it seems (correct me if I am wrong) that theEvent doesn't need to be manually released, because it has been declared as an OUT parameter rather than a VAR parameter. So, if this is true, this information is crucial when writing interface

Re: [fpc-devel] Reference counting interface objects

2014-10-16 Thread Michael Van Canneyt
On Thu, 16 Oct 2014, Adriaan van Os wrote: Section 7.6 in the FreePascal Language Reference discusses automatic reference counting for COM interfaces. It details assignments to variables and temporary variables. But the section doesn't mention parameter passing. What happens when interfaces

[fpc-devel] Reference counting interface objects

2014-10-16 Thread Adriaan van Os
Section 7.6 in the FreePascal Language Reference discusses automatic reference counting for COM interfaces. It details assignments to variables and temporary variables. But the section doesn't mention parameter passing. What happens when interfaces are passed to functions, procedures and methods