在valedit.pas中,TValueListStrings类没有实现虚拟的Destroy方法,它实现了虚拟的Clear方法, 但是它的父类TStringList的Destroy中并不通过调用Clear()来释放资源,因此TValueListStrings中为成员ItemProps分配的内存就丢失了.
所以如果在Form中添加了TValueListEditor控件,并且在代码中使用了其ItemProperty成员(因为它是延迟分配,只有第一次使用时才分配内存),则需要在Form.Destroy()方法中显式的调用Clear()方法,如下:
MyForm.Destroy(){ ... MyValueListEditor->Strings->Clear(); ...}
这是在C++ Builder 6的VCL Source中发现的, 估计 Delphi 6中也应该有这个Bug.