Changeset - r5659:f82ff099edea
[Not reviewed]
master
0 1 0
Darkvater - 17 years ago 2007-01-14 17:17:30
darkvater@openttd.org
(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
1 file changed with 10 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/openttd.cpp
Show inline comments
 
@@ -263,9 +263,15 @@ static void InitializeDynamicVariables(v
 
	_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
 

	
 
	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;
 
}
0 comments (0 inline, 0 general)