Plugging up some memory leaks in the Blenderplayer that I found with valgrind
authorMitchell Stokes <mogurijin@gmail.com>
Tue, 21 Dec 2010 06:58:44 +0000 (06:58 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Tue, 21 Dec 2010 06:58:44 +0000 (06:58 +0000)
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/VideoTexture/PyTypeList.cpp
source/gameengine/VideoTexture/PyTypeList.h

index 197e31af1886d1dfe13d13cf64d7cd5239a2551a..d1dee0521730ac1e25616cf2ac27f10e4db6c6c4 100644 (file)
@@ -802,7 +802,6 @@ void GPG_Application::exitEngine()
                m_canvas = 0;
        }
 
-       IMB_exit();
        GPU_extensions_exit();
 
        m_exitRequested = 0;
index d9aaa56b19e93ae24e2f7d5efb0cb0a44d69dc5f..b7f4cacf5ab4c7061232cf952cc6c7451380b8b0 100644 (file)
@@ -943,7 +943,12 @@ int main(int argc, char** argv)
                }
        }
 
-       free_nodesystem();
+       // Cleanup
+       RNA_exit();
+       BLF_exit();
+       free_blender();
+
+       SYS_DeleteSystem(syshandle);
 
        return error ? -1 : 0;
 }
index 2d571675dbd834ce0d222be587131af9f53344d9..c374348da26f681a77b7b6c3f24461971c746705 100644 (file)
@@ -28,6 +28,14 @@ http://www.gnu.org/copyleft/lesser.txt.
 
 #include <PyObjectPlus.h>
 
+/// destructor
+PyTypeList::~PyTypeList()
+{
+       // if list exists
+       if (m_list.get() != NULL)
+               for (PyTypeListType::iterator it = m_list->begin(); it != m_list->end(); ++it)
+                       delete *it;
+}
 
 /// check, if type is in list
 bool PyTypeList::in (PyTypeObject * type)
index 4daf88bfa19efd2dfda729d655ec5fc74b06dd73..8ca1e976de75c2e93b372df6d585b319e6f19b92 100644 (file)
@@ -41,6 +41,9 @@ typedef std::vector<PyTypeListItem*> PyTypeListType;
 class PyTypeList
 {
 public:
+       /// destructor
+       ~PyTypeList();
+
        /// check, if type is in list
        bool in (PyTypeObject * type);