From 0023eb77f86c8e2e84e43c77ba0252bb7b87e7ff Mon Sep 17 00:00:00 2001 From: psperl Date: Tue, 31 Jan 2012 02:06:21 +0000 Subject: [PATCH] memory leak fix git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1386 6778bc44-b910-0410-a7a0-be141de4315d --- .../MilkdropPresetFactory/MilkdropPreset.cpp | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/libprojectM/MilkdropPresetFactory/MilkdropPreset.cpp b/src/libprojectM/MilkdropPresetFactory/MilkdropPreset.cpp index b45532f3c..d6acc7b4c 100755 --- a/src/libprojectM/MilkdropPresetFactory/MilkdropPreset.cpp +++ b/src/libprojectM/MilkdropPresetFactory/MilkdropPreset.cpp @@ -75,32 +75,24 @@ MilkdropPreset::~MilkdropPreset() /// Testing deletion of render items by the preset. would be nice if it worked, /// and seems to be working if you use a mutex on the preset switching. -/* - std::cout << "begin freeing of waves / shapes" << std::endl; - + for (PresetOutputs::cwave_container::iterator pos = customWaves.begin(); pos != customWaves.end(); ++pos ) { - for (PresetOutputs::cwave_container::iterator pos2 = presetOutputs().customWaves.begin(); - pos2 != presetOutputs().customWaves.end(); ++pos2 ) { - if ((*pos2)->id == (*pos)->id) - presetOutputs().customWaves.erase(pos2); - } - delete(*pos); + // __android_log_print(ANDROID_LOG_ERROR, "projectM", "not freeing wave %x", *pos); + delete(*pos); } for (PresetOutputs::cshape_container::iterator pos = customShapes.begin(); pos != customShapes.end(); ++pos ) { +//__android_log_print(ANDROID_LOG_ERROR, "projectM", "not freeing shape %x", *pos); - for (PresetOutputs::cshape_container::iterator pos2 = presetOutputs().customShapes.begin(); -1aaa339f10vmlkd pos2 != presetOutputs().customShapes.end(); ++pos2 ) { - if ((*pos2)->id == (*pos)->id) - presetOutputs().customShapes.erase(pos2); - } delete(*pos); } - - std::cout << "end freeing of waves / shapes" << std::endl; - */ + customWaves.clear(); + customShapes.clear(); + presetOutputs().customWaves.clear(); + presetOutputs().customShapes.clear(); + presetOutputs().drawables.clear(); }