//--------------------------------------------------------------------------- void __fastcall FreeLogForm() { if (LogForm) { TLogForm * PLogForm = LogForm; LogForm = NULL; // would also free form see TLogForm::FormClose() // we can't free form directly (cause exception when form is closed by // button on toolbar, beacuse it destroys the button too) PLogForm->Close(); } }