My class' destructor implementation looks like this:
destructor TMyClass.Free;
begin
{ ...Some housecleaning... }
inherited Free;
end;
So I didn't want to override TObject.Free just placed inherited Free in my destructor and I think it normally mustn't cause any errors.
So yes, this code must crash.
In TOBject Free is a procedure, not a destructor. But it does call a destructor.
In you code Free is a destructor, so when your Free has run, your onject gets destroyed. But it has been destroyed by Free in the meantime...
So at the end of your Free an already destroyed object is destroyed again.
If Free was a destructor, that would be ok => because calling an inherited destructor, within a destructor does not trigger a 2nd destruction.
Your code fails for the same reason as the following example (not tested)
Var // global
Foo: TFoo;
Destructor TFoo.Destroy;
begin
Foo.Destroy;
inherited; // optional / makes no differnece
end;
Procedure SomeElse;
begin
Foo.Destroy;
end;
Foo Destroy will be called twice.