Improve error handling #977

Merged
merged 2 commits into from Sep 17, 2012

Conversation

Projects
None yet
3 participants
Collaborator

igorko commented Sep 16, 2012

Discovered while trying to load GameStateLoad screen on Polymorphable with Flare savegame in the list. Also added exit(1) where needed to really terminate app correctly.

Collaborator

igorko commented Sep 16, 2012

oops. It doesn't build.

Collaborator

stefanbeller commented Sep 16, 2012

In http://sdl.beuc.net/sdl.wiki/SDL_Quit they say we could also use atexit(SDL_Quit);
Not sure what's the best approach though.

Note: While using "atexit" may be be fine for small programs, more advanced users should shut down SDL in their own cleanup code. Moreover, using "atexit" in a library is a sure way to crash dynamically loaded code.

Collaborator

igorko commented Sep 16, 2012

No idea why that exit(1) is blamed by g++, but we can leave without it ;)

@ghost

ghost commented Sep 16, 2012

There's a member variable named "exit" in MenuManager. You can probably use something like "std::exit(1)" to avoid the name collision.

Collaborator

stefanbeller commented Sep 16, 2012

Another idea would be to put the exit (or abort function?) together with a previous SDL_Quit into a function, as the sequence

SDL_Quit()
exit(1);

happens to appear quite often now.

Owner

clintbellanger commented Sep 17, 2012

Consider this a short-term fix. During Beta we will have better clean-up code that will attempt to free memory properly.

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

@clintbellanger clintbellanger merged commit 47d32d8 into clintbellanger:master Sep 17, 2012

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