Search code examples
delphiself-destruction

Delphi: Is it ok for a form to free it self?


I have a form that I use to show some information for some seconds. Is it ok for the form to free itself? Can I start a timer in the constructor, and then call self.free in the timer-event? Or will this potentially lead to trouble?


Solution

  • In addition, with a form you can call Release.

    It sends a CM_RELEASE message to the form. As a reaction it calls Free. The advantage of release is that there are no messages left for the form which could result in a crash.