When objects are freed, the Destroy destructor method is called.
Destroy must be an override (or virtual) method.
All classes inherit from TObject, which declares a virtual Destroy
method, and should override this method to provide their own implementation.
To ensure that ancestor class destructors are also called, inherited should be called
at the end of the destructor. Not doing so may cause the object to be only partially
deinitialized.
Add an inherited call to the end of the destructor:
destructor TMyObj.Destroy; begin FreeAndNil(FObj); end;
destructor TMyObj.Destroy; begin FreeAndNil(FObj); inherited; end;