diff options
author | frosch <frosch@openttd.org> | 2011-06-11 20:40:46 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-06-11 20:40:46 +0000 |
commit | b2275b40935603d15030a8f79fff1f56bdb5ab0e (patch) | |
tree | af594dfcba891537d7dfac79525e921d9c2b75d2 /src | |
parent | 86f931a065ca11c375c536872beb61ab3935e8e0 (diff) | |
download | openttd-b2275b40935603d15030a8f79fff1f56bdb5ab0e.tar.xz |
(svn r22551) -Fix: Remove BaseStorageArrays from _changed_storage_arrays on destruction.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_storage.cpp | 8 | ||||
-rw-r--r-- | src/newgrf_storage.h | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/newgrf_storage.cpp b/src/newgrf_storage.cpp index 27a806ab1..c1c736e20 100644 --- 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. diff --git a/src/newgrf_storage.h b/src/newgrf_storage.h index a85bbbde6..f03308509 100644 --- 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. |