[fpc-pascal] Using Supports() I got an AV... bug?

Marcos Douglas B. Santos md at delfire.net
Sun Mar 11 15:36:07 CET 2018


On Sun, Mar 11, 2018 at 11:17 AM, Vojtěch Čihák <vojtech.cihak at atlas.cz> wrote:
> Yes, TBar is TInterfacedObject and is reference counted therefore Free is
> not needed.
>
> Just comment the line //Bar.Free; compile with -gh and you will see no
> memory leak.

You think this is the problem...
All right, try to change your copy like this:

===begin===
  Bar := TBar.Create;
  try
    if Supports(Bar, IBar) then
      Writeln(Bar.Name + ' supports...');
  finally
    ////Bar.Free;  << no Free
  end;
===end===

Are you still seeing an AV?

Marcos Douglas


More information about the fpc-pascal mailing list