Make adding new options easy. Note destructor is using for loop with iterators to delete widgets(objects). This should make a deal because i get the same memory leftover when apply delete for each object. Even when using:
for (unsigned int i = 0; i < child_widget.size(); i++)
{
delete child_widget[i];
}
memory leak is the same, which looks like the most wrong implementation
But some memory still leaks(and iirc it did before). If anyone could uncover the reason (@stefanbeller ?) I would be happy.
here is code for freeing memory using delete for each object (large list, to make testing easier) http://pastebin.com/FgPAcugK
Confirming, settings menu leaks the same amount of memory without these changes. So this pull request has no regressions, and memory leak is left as homework ;)
Make adding new options easy. Note destructor is using for loop with iterators to delete widgets(objects). This should make a deal because i get the same memory leftover when apply delete for each object. Even when using:
for (unsigned int i = 0; i < child_widget.size(); i++) { delete child_widget[i]; }
memory leak is the same, which looks like the most wrong implementation
But some memory still leaks(and iirc it did before). If anyone could uncover the reason (@stefanbeller ?) I would be happy.
here is code for freeing memory using delete for each object (large list, to make testing easier) http://pastebin.com/FgPAcugK