Hello,

What is the recommended way to avoid memory leaks in mutual interface
references?

>From delphi 10.1 Berlin it is possible to use [unsafe] e [weak] attributes.
http://blog.marcocantu.com/blog/2016-april-weak-unsafe-interface-references.html
.

Is there a workaround in Free Pascal 3?

Regards

==== CODE ====

type
  IMyInterfaceA = interface
     procedure Foo;
  end;

  IMyInterfaceB = interface
    procedure Bar;
  end;

  TMyInterfaceA = class(TInterfacedObject, IMyInterfaceA)
  private
     var FMyInterfaceB: IMyInterfaceB;
      ....
  end;


  TMyInterfaceB = class(TInterfacedObject, IMyInterfaceB)
  private
     var FMyInterfaceA: IMyInterfaceA;
      ....
  end;

   .........

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

Reply via email to