Browse Source

* when calling GetInterfaceByStr on COM Objects, the refcounter was not increased
* this bugfix fixes bugreport #0012778

git-svn-id: trunk@15073 -

ivost 15 years ago
parent
commit
3f2d66b188
1 changed files with 4 additions and 0 deletions
  1. 4 0
      rtl/inc/objpas.inc

+ 4 - 0
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;