From: sapier Date: Tue, 9 Apr 2013 18:14:07 +0000 (+0200) Subject: Really fix itemdef memory leak X-Git-Tag: 0.4.7~29^2~11 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ee1155fe6d5683578294c0ea20a8a3a0bf8ecbe4;p=oweals%2Fminetest.git Really fix itemdef memory leak --- diff --git a/src/itemdef.cpp b/src/itemdef.cpp index 05328ea48..d660db77f 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -226,17 +226,11 @@ class CItemDefManager: public IWritableItemDefManager public: CItemDefManager() { - for (std::map::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() @@ -260,6 +254,12 @@ public: } m_driver = NULL; #endif + for (std::map::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 {