"as" increase .RefCount in INTERFACE
Original Reporter info from Mantis: VAleks2
-
Reporter name: Aleks Vtyurin
Original Reporter info from Mantis: VAleks2
- Reporter name: Aleks Vtyurin
Description:
When use "as" for interface typecasts ".RefCount" increase.
Additional information:
var
obj: TInterfacedObject;
iobj, iobj2: IUnknown;
begin
obj:= TInterfacedObject.Create;
WriteLn('obj.RefCount=', obj.RefCount); // =0
iobj:= obj;
WriteLn('obj.RefCount=', obj.RefCount); // =1
iobj2:= iobj as IUnknown; //Error!!!
WriteLn('obj.RefCount=', obj.RefCount); // need 2, get 3
iobj2:= nil;
WriteLn('obj.RefCount=', obj.RefCount); // need 1, get 2
iobj:= nil;
WriteLn('obj.RefCount=', obj.RefCount); // need 0, get 1
end.
Mantis conversion info:
- Mantis ID: 9472
- Version: 2.2.0
- Monitored by: » VAleks2 (Aleks Vtyurin), » crossbuilder (Burkhard Carstens), » luizamerico (Luiz Americo), » etrusco (Flávio Etrusco)