Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
BUG: Memory leak at ProjectManagerUI::BuildProjectTree
sodev:
It *might* lead to a memory leak, the original FileTreeData object gets passed to a recursive call to ProjectAddTreeNode() that does not add it to a tree in every case, however i don't know if these cases can actually happen in the way this method gets called in that context. Without any deeper understanding of the code i would say it would be a good idea to delete the object inside ProjectAddTreeNode() when it returns without adding it to a tree.
oBFusCATed:
I agree with sodev. This is a patch that implements the suggestion. I don't see any other problem with the function.
Does someone know how to make C::B execute the changed paths?
I've set some breakpoints on the added delete calls, but I couldn't make C::B hit them with my projects.
--- Code: ---Index: src/src/projectmanagerui.cpp
===================================================================
--- src/src/projectmanagerui.cpp (revision 9609)
+++ src/src/projectmanagerui.cpp (working copy)
@@ -2535,7 +2535,10 @@ wxTreeItemId ProjectAddTreeNode(cbProject* project, wxTreeCtrl* tree, const wxS
wxTreeItemId ret;
if (text.IsEmpty())
+ {
+ delete data;
return ret;
+ }
wxString path = text;
@@ -2548,7 +2551,10 @@ wxTreeItemId ProjectAddTreeNode(cbProject* project, wxTreeCtrl* tree, const wxS
path.Remove(0, 1);
if (path.IsEmpty())
+ {
+ delete data;
return ret;
+ }
int pos = path.Find(_T('/'));
if (pos == -1)
--- End code ---
@jens: I can't download your valgrind log file. :(
oBFusCATed:
After looking at the other topic about the same issue, I've been able to reproduce it, so I'm committing this change.
Jenna:
--- Quote from: oBFusCATed on January 26, 2014, 02:57:25 pm ---@jens: I can't download your valgrind log file. :(
--- End quote ---
Should work now, sorry.
Navigation
[0] Message Index
[*] Previous page
Go to full version