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

# TButtonGlyph.Destroy

Destroy - destructor for TButtonGlyph: frees caches and calls inherited Destroy

## Declaration

Source position: buttons.pp line 116

`public destructor TButtonGlyph.Destroy; override;`

## Description

If you call Destroy for an object which hasn´t being initialized yet it will generate an error. Always use the Free method to deallocate objects, because it verifies if object variable doesn´t contain the value nil. Take the following precautions when creating your own Destroy method: * Declare Destroy with the override directive, because it is a virtual method. * Always call 'inherited Destroy;' as the last thing on the destructor code. * An exception may be raised on the constructor in case there is not enought memory to create an object, or something else goes wrong. If the exception is not handled inside the constructor, the object will be only partially built. In this case Destroy will be called, so your destructor must check if the resources were really allocated before disposing of them. * Remember to call Free for all objects created on the constructor.

## See also

TObject.Destroy

The latest version of this document can be found at lazarus-ccr.sourceforge.net.