* Fix bug ID #32353, reset ref count fields in destructor

git-svn-id: trunk@37112 -
This commit is contained in:
michael 2017-09-02 15:07:23 +00:00
parent 0088673d13
commit 3787d52dee
2 changed files with 12 additions and 0 deletions

View File

@ -1050,6 +1050,15 @@
end;
end;
destructor TInterfacedObject.destroy;
begin
// We must explicitly reset. Bug ID 32353
FRefCount:=0;
FDestroyCount:=0;
inherited destroy;
end;
procedure TInterfacedObject.AfterConstruction;
begin

View File

@ -294,6 +294,8 @@
VarResult,ExcepInfo,ArgErr : pointer) : HResult;stdcall;
end;
{ TInterfacedObject }
TInterfacedObject = class(TObject,IUnknown)
protected
frefcount : longint;
@ -303,6 +305,7 @@
function _AddRef : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
function _Release : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
public
destructor destroy; override;
procedure AfterConstruction;override;
procedure BeforeDestruction;override;
class function NewInstance : TObject;override;