mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-10 19:09:45 +01:00
Clean up all leftover resources in cleanup()
If there's a resource that doesn't otherwise need to be cleaned up and is still alive upon program shutdown, then it should go in cleanup(). This cleans up Screen, GraphicsResources, Graphics buffers, Graphics tiles, and musicclass audio upon program shutdown. Even we technically don't NEED to clean these resources up ourselves (the kernel is going to get rid of all of it anyway, else it'd be a security problem), I'm doing this because otherwise Valgrind will complain about these, and then it'd be difficult to see which memory leaks are real and which are just "well this isn't really a leak but you haven't freed this thing when the process exited, and that's technically what a memory leak is". These are all resources whose cleanup functions can be safely called even if they haven't initialized anything yet.
This commit is contained in:
parent
39e316828e
commit
efbaeeffde
1 changed files with 6 additions and 0 deletions
|
@ -365,7 +365,13 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
static void cleanup()
|
static void cleanup()
|
||||||
{
|
{
|
||||||
|
/* Order matters! */
|
||||||
game.savestatsandsettings();
|
game.savestatsandsettings();
|
||||||
|
gameScreen.destroy();
|
||||||
|
graphics.grphx.destroy();
|
||||||
|
graphics.destroy_buffers();
|
||||||
|
graphics.destroy();
|
||||||
|
music.destroy();
|
||||||
NETWORK_shutdown();
|
NETWORK_shutdown();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
FILESYSTEM_deinit();
|
FILESYSTEM_deinit();
|
||||||
|
|
Loading…
Reference in a new issue