mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 15:45:57 +02:00
* fixed memory leak with the as operator, fixes #7174
git-svn-id: trunk@4355 -
This commit is contained in:
parent
3e1c0cc8a5
commit
849878b472
@ -251,8 +251,8 @@ function fpc_do_as(aclass : tclass;aobject : tobject): tobject; compilerproc;
|
||||
procedure fpc_intf_decr_ref(var i: pointer); compilerproc;
|
||||
procedure fpc_intf_incr_ref(i: pointer); compilerproc;
|
||||
procedure fpc_intf_assign(var D: pointer; const S: pointer); compilerproc;
|
||||
function fpc_intf_as(const S: pointer; const iid: TGUID): pointer; compilerproc;
|
||||
function fpc_class_as_intf(const S: pointer; const iid: TGUID): pointer; compilerproc;
|
||||
function fpc_intf_as(const S: pointer; const iid: TGUID): IInterface; compilerproc;
|
||||
function fpc_class_as_intf(const S: pointer; const iid: TGUID): IInterface; compilerproc;
|
||||
|
||||
Function fpc_PushExceptAddr (Ft: Longint;_buf,_newaddr : pointer): PJmp_buf ; compilerproc;
|
||||
Procedure fpc_PushExceptObj (Obj : TObject; AnAddr,AFrame : Pointer); compilerproc;
|
||||
|
@ -63,8 +63,7 @@
|
||||
D:=S;
|
||||
end;
|
||||
|
||||
function fpc_intf_as(const S: pointer; const iid: TGUID): pointer;[public,alias: 'FPC_INTF_AS']; compilerproc;
|
||||
|
||||
function fpc_intf_as(const S: pointer; const iid: TGUID): IInterface;[public,alias: 'FPC_INTF_AS']; compilerproc;
|
||||
var
|
||||
tmpi: pointer; // _AddRef before _Release
|
||||
begin
|
||||
@ -72,14 +71,14 @@
|
||||
begin
|
||||
if IUnknown(S).QueryInterface(iid,tmpi)<>S_OK then
|
||||
handleerror(219);
|
||||
fpc_intf_as:=tmpi;
|
||||
pointer(fpc_intf_as):=tmpi;
|
||||
end
|
||||
else
|
||||
fpc_intf_as:=nil;
|
||||
end;
|
||||
|
||||
|
||||
function fpc_class_as_intf(const S: pointer; const iid: TGUID): pointer;[public,alias: 'FPC_CLASS_AS_INTF']; compilerproc;
|
||||
function fpc_class_as_intf(const S: pointer; const iid: TGUID): IInterface;[public,alias: 'FPC_CLASS_AS_INTF']; compilerproc;
|
||||
|
||||
var
|
||||
tmpi: pointer; // _AddRef before _Release
|
||||
@ -88,7 +87,7 @@
|
||||
begin
|
||||
if not TObject(S).GetInterface(iid,tmpi) then
|
||||
handleerror(219);
|
||||
fpc_class_as_intf:=tmpi;
|
||||
pointer(fpc_class_as_intf):=tmpi;
|
||||
end
|
||||
else
|
||||
fpc_class_as_intf:=nil;
|
||||
|
Loading…
Reference in New Issue
Block a user