Browse Source

* Fix ref count of interface during cast

Michaël Van Canneyt 1 year ago
parent
commit
78c8ca57ad
1 changed files with 3 additions and 0 deletions
  1. 3 0
      packages/rtl-objpas/src/inc/rtti.pp

+ 3 - 0
packages/rtl-objpas/src/inc/rtti.pp

@@ -2791,7 +2791,10 @@ begin
     Exit;
   aRes:=TObject(AsObject).GetInterface(aGUID,P);
   if aRes then
+    begin
     TValue.Make(@P,aDestType,aDest);
+    IUnknown(P)._Release;
+    end;
 end;
 
 Procedure TValue.CastInterfaceToInterface(out aRes : Boolean; out ADest: TValue; aDestType: PTypeInfo);