Unused interface reference is not destroyed

拟墨画扇 提交于 2019-12-03 07:17:06
Jeroen Wiert Pluimers

It is a different manifestation of the bugs here.
I will add this to the QC report.

This does not reproduce in Delphi XE update 1 any more.

--jeroen

Add a guid to you ITest declaration

ITest = interface
['{DB6637F9-FAD3-4765-9EC1-0A374AAC7469}']
    procedure Test;
end;

Change the loop to this

for x in list do
    x.UseTestOrNot(Tester.Create as ITest);

The GUID is neccesary to be able to use as

Test.Create as ITest makes the compiler to add the release where the created object goes out of scope.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!