Generic TList<> in Delphi 2009 crash on IndexOf

故事扮演 提交于 2019-12-01 08:41:09
Roddy

Have a look at this question. Why is TList.Remove() producing an EAccessViolation error?

In particular, try creating your TList like this

TList<TTest>.Create(TComparer<TTest>.Default);

This is a bug in the default constructor of TObjectList<T>, and I thought it was fixed in update 3. If you're still seeing it, use a different constructor or just update to D2010 or XE, where it's definitely fixed. (And you'll really want to get off of D2009 if you want to work with generics anyway.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!