changeset 16065:e11bb68f2fa6 draft

(svn r20758) -Fix: when leaving the program, current newgrf config would leak, causing valgrind warnings
author smatz <smatz@openttd.org>
date Mon, 06 Sep 2010 18:20:07 +0000
parents ef2a6d2212f6
children a49f518668dd
files src/newgrf.cpp src/newgrf.h src/openttd.cpp
diffstat 3 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -6984,7 +6984,7 @@
  * Reset all NewGRF loaded data
  * TODO
  */
-static void ResetNewGRFData()
+void ResetNewGRFData()
 {
 	CleanUpStrings();
 	CleanUpGRFTownNames();
--- a/src/newgrf.h
+++ b/src/newgrf.h
@@ -159,6 +159,7 @@
 void LoadNewGRFFile(struct GRFConfig *config, uint file_index, GrfLoadingStage stage);
 void LoadNewGRF(uint load_index, uint file_index);
 void ReloadNewGRFData(); // in saveload/afterload.cpp
+void ResetNewGRFData();
 
 void CDECL grfmsg(int severity, const char *str, ...) WARN_FORMAT(2, 3);
 
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -59,6 +59,7 @@
 #include "rail_gui.h"
 #include "core/backup_type.hpp"
 #include "hotkeys.h"
+#include "newgrf.h"
 
 
 #include "town.h"
@@ -347,6 +348,8 @@
 	free(_config_file);
 #endif
 
+	ResetNewGRFData();
+
 	/* Close all and any open filehandles */
 	FioCloseAll();
 }