Skip to content

Commit

Permalink
Really fix itemdef memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
sapier authored and PilzAdam committed May 9, 2013
1 parent 3b1c3ac commit ee1155f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/itemdef.cpp
Expand Up @@ -226,17 +226,11 @@ class CItemDefManager: public IWritableItemDefManager
public:
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
m_main_thread = get_current_thread_id();
m_driver = NULL;
#endif

clear();
}
virtual ~CItemDefManager()
Expand All @@ -260,6 +254,12 @@ class CItemDefManager: public IWritableItemDefManager
}
m_driver = NULL;
#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
{
Expand Down

0 comments on commit ee1155f

Please sign in to comment.