[fpc-pascal] Delegate Interface class does not seem to be referenced counted
Marco van de Voort
marcov at stack.nl
Wed Aug 10 16:05:49 CEST 2016
In our previous episode, Marcos Douglas said:
> On Wed, Aug 10, 2016 at 10:04 AM, Tony Whyman
> > Destroying FMyInterface in the destructor does not make a difference -
> > mainly because the TMyClass destructor is not being called anyway.
> It should be called, but is not. Strange.
> I tried to change the code to not using Application, DoRun, etc but
> the result is same.
There is still mixing of classes and interfaces going on.
Rule of thumb is that unless you are _VERY_ sure about what you are doing,
create the class directly to an interface typed variable, and keep in
interface typed variables.
The way how Tony passes owner is wrong and that messes up reference
If in the test he would do TMyclass.Create(Tsomeclass.create); it probably
would be ok.
More information about the fpc-pascal