Browse Source

* fixed Supports function so that it's using new function GetInterfaceWeak. Supports may have accidentially freed a objects.

git-svn-id: trunk@15078 -
ivost 15 years ago
parent
commit
5a588e5f06
1 changed files with 2 additions and 2 deletions
  1. 2 2
      rtl/objpas/sysutils/sysuintf.inc

+ 2 - 2
rtl/objpas/sysutils/sysuintf.inc

@@ -27,9 +27,9 @@ end;
 
 function Supports(const Instance: TObject; const IID: TGUID; out Intf): Boolean;
 var
-  Temp: IInterface;
+  Temp: Pointer; // weak
 begin
-  Result:=(Instance<>nil) and ((Instance.GetInterface(IInterface,Temp) and (Temp.QueryInterface(IID,Intf)=S_OK))
+  Result:=(Instance<>nil) and ((Instance.GetInterfaceWeak(IInterface,Temp) and (IInterface(Temp).QueryInterface(IID,Intf)=S_OK))
     or Instance.GetInterface(IID,Intf));
   { Some applications expect that the QueryInterface method is invoked as first priority
     to query for an interface and GetInterface as 2nd priority }