From 3f2d66b188fd55f40bee73f6dd6cda26afa2f5d8 Mon Sep 17 00:00:00 2001 From: ivost Date: Sat, 27 Mar 2010 11:12:46 +0000 Subject: [PATCH] * when calling GetInterfaceByStr on COM Objects, the refcounter was not increased * this bugfix fixes bugreport #0012778 git-svn-id: trunk@15073 - --- rtl/inc/objpas.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtl/inc/objpas.inc b/rtl/inc/objpas.inc index f623a9deb7..1419d38936 100644 --- a/rtl/inc/objpas.inc +++ b/rtl/inc/objpas.inc @@ -708,6 +708,10 @@ continue search } Instance := TObject(obj); until False; + { Getter function will normally AddRef, so adding another reference here + will cause memleak. com interfaces only!! } + if result and Assigned(IEntry^.IID) and (IEntry^.IType in [etStandard, etFieldValue]) then + IInterface(obj)._AddRef; end; function TObject.getinterface(const iidstr : shortstring;out obj) : boolean;