Patch #958 2006-03-27 15:33

dermeister

Remove some memory-leaks
Download
958-Remove_some_mem.patch (1.6 KB)
Category
 
Status
Accepted
Close date
2006-04-05 07:55
Assigned to
 
Index: src/sdk/editorcolorset.cpp
===================================================================
--- src/sdk/editorcolorset.cpp  (revision 2274)
+++ src/sdk/editorcolorset.cpp  (working copy)
@@ -89,6 +89,11 @@
 
 void EditorColorSet::ClearAllOptionColors()
 {
+       for (OptionSetsMap::iterator map_it = m_Sets.begin();
+                                                       map_it != m_Sets.end(); ++map_it)
+        for (OptionColors::iterator vec_it = (*map_it).second.m_Colors.begin();
+                            vec_it != (*map_it).second.m_Colors.end(); ++vec_it)
+                       delete (*vec_it);
     m_Sets.clear();
 }
 
Index: src/sdk/pluginmanager.cpp
===================================================================
--- src/sdk/pluginmanager.cpp   (revision 2274)
+++ src/sdk/pluginmanager.cpp   (working copy)
@@ -357,6 +357,7 @@
             m_Plugins[i]->freeProc(plug);
         else
             delete plug; // try to delete it ourselves...
+               delete m_Plugins[i];
     }
 }
 
Index: src/sdk/messagemanager.cpp
===================================================================
--- src/sdk/messagemanager.cpp  (revision 2274)
+++ src/sdk/messagemanager.cpp  (working copy)
@@ -185,6 +185,8 @@
 
     delete m_pNotebook->GetImageList();
     m_pNotebook->Destroy();
+    for (LogsMap::iterator it = m_Logs.begin(); it != m_Logs.end(); ++it)
+               delete (*it).second;
 }
 
 void MessageManager::CreateMenu(wxMenuBar* menuBar)
@@ -314,6 +316,7 @@
     {
         if (it->second->log == log)
         {
+               delete (*it).second;
             m_Logs.erase(it);
             break;
         }
dermeister 2006-03-27 15:34

This patch removes the following three memory-leaks:

http://forums.codeblocks.org/index.php?topic=2721.0

Note: I also replaced some wxArrays with std::vector.

dermeister 2006-03-29 14:32

I updated the patch. Now it just removes the memory leaks and leaves the wx containers untouched.