Don't use arrays in GameStateConfig #981

Merged
merged 2 commits into from Sep 17, 2012

Conversation

Projects
None yet
2 participants
Collaborator

igorko commented Sep 17, 2012

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

Collaborator

igorko commented Sep 17, 2012

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

@clintbellanger clintbellanger added a commit that referenced this pull request Sep 17, 2012

@clintbellanger clintbellanger Merge pull request #981 from igorko/settings
Don't use arrays in GameStateConfig
b421e5b

@clintbellanger clintbellanger merged commit b421e5b into clintbellanger:master Sep 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment