changeset 17767:6a3cc2837af9 draft

(svn r22551) -Fix: Remove BaseStorageArrays from _changed_storage_arrays on destruction.
author frosch <frosch@openttd.org>
date Sat, 11 Jun 2011 20:40:46 +0000
parents 1098d7a95f64
children 9461da980e62
files src/newgrf_storage.cpp src/newgrf_storage.h
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_storage.cpp
+++ b/src/newgrf_storage.cpp
@@ -17,6 +17,14 @@
 static std::set<BaseStorageArray*> _changed_storage_arrays;
 
 /**
+ * Remove references to use.
+ */
+BaseStorageArray::~BaseStorageArray()
+{
+	_changed_storage_arrays.erase(this);
+}
+
+/**
  * Add the changed storage array to the list of changed arrays.
  * This is done so we only have to revert/save the changed
  * arrays, which saves quite a few clears, etc. after callbacks.
--- a/src/newgrf_storage.h
+++ b/src/newgrf_storage.h
@@ -20,8 +20,7 @@
  */
 struct BaseStorageArray
 {
-	/** The needed destructor */
-	virtual ~BaseStorageArray() {}
+	virtual ~BaseStorageArray();
 
 	/**
 	 * Clear the changes made since the last ClearChanges.