From b2275b40935603d15030a8f79fff1f56bdb5ab0e Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 11 Jun 2011 20:40:46 +0000 Subject: [PATCH] (svn r22551) -Fix: Remove BaseStorageArrays from _changed_storage_arrays on destruction. --- src/newgrf_storage.cpp | 8 ++++++++ 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 27a806ab1f..c1c736e205 100644 --- a/src/newgrf_storage.cpp +++ b/src/newgrf_storage.cpp @@ -16,6 +16,14 @@ /** The changed storage arrays */ static std::set _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 diff --git a/src/newgrf_storage.h b/src/newgrf_storage.h index a85bbbde6d..f03308509b 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.