diff options
author | Darkvater <darkvater@openttd.org> | 2007-01-14 17:17:30 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2007-01-14 17:17:30 +0000 |
commit | 54b88bc8e6b3688b9bf9d1da0afa2e25d828e772 (patch) | |
tree | a796ed9ec771a54767292c40cc5188e6b67df62d | |
parent | 468f53911d28e5868cfd30bb8d65d69c538aa256 (diff) | |
download | openttd-54b88bc8e6b3688b9bf9d1da0afa2e25d828e772.tar.xz |
(svn r8119) -Fix (r8101): Uninitializing windows should be called before freeing dynamic variables as windows could use those variables during cleanup (eg WE_DESTROY calling GetStation(w->window_number).
-Merged UnInitializeGame with UnInitializeAirports and UnInitializeDynamicVariables
-rw-r--r-- | src/openttd.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 9223d1d43..10eb7f55e 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -263,9 +263,15 @@ static void InitializeDynamicVariables(void) _industry_sort = NULL; } -static void UnInitializeDynamicVariables(void) + +static void UnInitializeGame(void) { - /* Dynamic stuff needs to be free'd somewhere... */ + UnInitWindowSystem(); + + /* Uninitialize airport state machines */ + UnInitializeAirports(); + + /* Uninitialize variables that are allocated dynamically */ CleanPool(&_Town_pool); CleanPool(&_Industry_pool); CleanPool(&_Station_pool); @@ -275,11 +281,6 @@ static void UnInitializeDynamicVariables(void) free((void*)_town_sort); free((void*)_industry_sort); -} - -static void UnInitializeGame(void) -{ - UnInitWindowSystem(); free(_config_file); } @@ -547,18 +548,14 @@ int ttd_main(int argc, char *argv[]) SaveToHighScore(); } - // uninitialize airport state machines - UnInitializeAirports(); - - /* uninitialize variables that are allocated dynamic */ - UnInitializeDynamicVariables(); + /* Reset windowing system and free config file */ + UnInitializeGame(); /* stop the AI */ AI_Uninitialize(); /* Close all and any open filehandles */ FioCloseAll(); - UnInitializeGame(); return 0; } |