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
counting. 

If in the test he would do  TMyclass.Create(Tsomeclass.create); it probably
would be ok.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to