[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Forms' (#lcl)

TApplication.ReleaseComponent

Safely destroys a component used in the application.

Declaration

Source position: forms.pp line 1508

public procedure TApplication.ReleaseComponent(

  AComponent: TComponent

);

Arguments

AComponent

  

The component to destroy.

Description

ReleaseComponent is a method used to ensure that the component in AComponent is freed in the application. During normal processing, ReleaseComponent adds the TComponent instance to a list and queues an asynchronously call to FreeComponent. This allows the component to be freed when the application enters an idle state.

If the Application Flags contains AppDestroying, the Free method for AComponent is called immediately.

No actions are performed in the method if Destroy has already been called for AComponent (ComponentState contains csDestroying).

ReleaseComponent is called from the ReleaseComponents method in TApplication, and from the Release method in TCustomForm. It may also be used in the implementation of controls to ensure that its resources are freed as needed.