diff --git a/rtl/inc/objpas.inc b/rtl/inc/objpas.inc index a234bc4b92..65e28b9261 100644 --- a/rtl/inc/objpas.inc +++ b/rtl/inc/objpas.inc @@ -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 diff --git a/rtl/inc/objpash.inc b/rtl/inc/objpash.inc index d7971ecedf..863db7462d 100644 --- a/rtl/inc/objpash.inc +++ b/rtl/inc/objpash.inc @@ -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;