建议用Release,如帮助中所说 Warning: Never explicitly free a component within one of its own event handlers or the event handler of a component it owns or contains. For example, don抰 free a button, or the form that owns the button, in its OnClick event handler.To free a form, call its Release method, which destroys the form and releases the memory allocated for it after all its event handlers and those of the components it contains are through executing.In C++ code, do not use Free to destroy an object. Use the delete keyword.
xxx:=yyy。creat(self);
xxx。showmodal;
xxx。free;
你可以这样更改:
if xxx <> nil then xxx.free
这个错误其实挺奇怪 因为这个程序我一直用都没有出现问题 最近我重新编译了他 所以出现了这个错误
这个问题其实很简单,按照SmallHand说的,释放前判断一下
如果已经是nil,查查是哪里已经free了
如果真是这样 是不是 把free 注释掉就成?
这个就要你自己判断了,之前的那次free是否是正确的free。
如果是,那你就注释现在的这句就可以了
2把所有调用该窗口的地方写个日志分析下,好久释放,就一目了然了
Warning:
Never explicitly free a component within one of its own event handlers or the event handler of a component it owns or contains. For example, don抰 free a button, or the form that owns the button, in its OnClick event handler.To free a form, call its Release method, which destroys the form and releases the memory allocated for it after all its event handlers and those of the components it contains are through executing.In C++ code, do not use Free to destroy an object. Use the delete keyword.
xxx:=yyy.creat(self);
xxx.showmodal;
xxx.free;
楼主可以看一下是否在XXX中有成员变量需要在XXX析构时释放的,已经在程序里被释放掉了。