I was wrong about the life-cycle of a Form.
I was wrong about the life-cycle of a Form. I thought it was Free()'d from Application.Run, but it's not. This appears to be the reality...
FormDestroy() is a called, but not where I thought.
The form is being created in the *.dpr with a CreateForm() and the associated FormDestroy() connected to the form isn't called until the "end." in the *.dpr, when a "unit finalization" calls Vcl.Forms.DoneApplication ->
System.Classes.TComponent.DestroyComponents ->
INstance.Destroy() ... and only then is FormDestroy() executed.
var
MyApp : TApplication;
begin
.
.
.
MyApp := Application;
MyApp.Initialize();
MyApp.CreateForm(TFMyForm, FMyForm);
MyApp.Run();
.
.
.
end. -> finally calls
1) Vcl.Forms.DoneApplication -> which calls
2) System.Classes.TComponent.DestroyComponents -> which calls
3) Instance.Destroy() -> which calls
4) FormDestroy()
FormDestroy() is a called, but not where I thought.
The form is being created in the *.dpr with a CreateForm() and the associated FormDestroy() connected to the form isn't called until the "end." in the *.dpr, when a "unit finalization" calls Vcl.Forms.DoneApplication ->
System.Classes.TComponent.DestroyComponents ->
INstance.Destroy() ... and only then is FormDestroy() executed.
var
MyApp : TApplication;
begin
.
.
.
MyApp := Application;
MyApp.Initialize();
MyApp.CreateForm(TFMyForm, FMyForm);
MyApp.Run();
.
.
.
end. -> finally calls
1) Vcl.Forms.DoneApplication -> which calls
2) System.Classes.TComponent.DestroyComponents -> which calls
3) Instance.Destroy() -> which calls
4) FormDestroy()
Comments
Post a Comment