Really fix itemdef memory leak

This commit is contained in:
sapier 2013-04-09 20:14:07 +02:00 committed by PilzAdam
parent 3b1c3ac678
commit ee1155fe6d

@ -226,17 +226,11 @@ class CItemDefManager: public IWritableItemDefManager
public: public:
CItemDefManager() CItemDefManager()
{ {
for (std::map<std::string, ItemDefinition*>::iterator iter =
m_item_definitions.begin(); iter != m_item_definitions.end();
iter ++) {
delete iter->second;
}
m_item_definitions.clear();
#ifndef SERVER #ifndef SERVER
m_main_thread = get_current_thread_id(); m_main_thread = get_current_thread_id();
m_driver = NULL; m_driver = NULL;
#endif #endif
clear(); clear();
} }
virtual ~CItemDefManager() virtual ~CItemDefManager()
@ -260,6 +254,12 @@ public:
} }
m_driver = NULL; m_driver = NULL;
#endif #endif
for (std::map<std::string, ItemDefinition*>::iterator iter =
m_item_definitions.begin(); iter != m_item_definitions.end();
iter ++) {
delete iter->second;
}
m_item_definitions.clear();
} }
virtual const ItemDefinition& get(const std::string &name_) const virtual const ItemDefinition& get(const std::string &name_) const
{ {