clintbellanger / flare

Free Libre Action Roleplaying Engine
http://clintbellanger.net/rpg/
GNU General Public License v3.0
166 stars 41 forks source link

Don't use arrays in GameStateConfig #981

Closed igorko closed 11 years ago

igorko commented 11 years ago

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

igorko commented 11 years ago

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 ;)