git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11782
e03df62e-2008-0410-955e-
edbf42e46eb7
*/
class CoreExport CullList
{
*/
class CoreExport CullList
{
- std::set<classbase*> list;
+ std::vector<classbase*> list;
public:
/** Adds an item to the cull list
*/
public:
/** Adds an item to the cull list
*/
- void AddItem(classbase* item) { list.insert(item); }
+ void AddItem(classbase* item) { list.push_back(item); }
/** Applies the cull list (deletes the contents)
*/
/** Applies the cull list (deletes the contents)
*/
* ---------------------------------------------------
*/
* ---------------------------------------------------
*/
- std::vector<classbase*> todel(list.begin(), list.end());
- list.clear();
- for(std::vector<classbase*>::iterator i = todel.begin(); i != todel.end(); i++)
+ std::set<classbase*> gone;
+ for(unsigned int i=0; i < list.size(); i++)
- classbase* c = *i;
- c->cull();
- delete c;
+ classbase* c = list[i];
+ if (gone.insert(c).second)
+ {
+ ServerInstance->Logs->Log("CULLLIST", DEBUG, "Deleting %s @%p", typeid(*c).name(),
+ (void*)c);
+ c->cull();
+ delete c;
+ }
+ else
+ {
+ ServerInstance->Logs->Log("CULLLIST",DEBUG, "WARNING: Object @%p culled twice!",
+ (void*)c);
+ }