Changeset - r17788:3b2375f0c0c3
[Not reviewed]
master
0 1 0
frosch - 13 years ago 2011-06-13 11:53:00
frosch@openttd.org
(svn r22583) -Fix [FS#4640] (r22551): Allocate _changed_storage_arrays on the heap, so the point of destruction is well defined ('never' for now).
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/newgrf_storage.cpp
Show inline comments
 
@@ -18,14 +18,14 @@ PersistentStoragePool _persistent_storag
 
INSTANTIATE_POOL_METHODS(PersistentStorage)
 

	
 
/** The changed storage arrays */
 
static std::set<BaseStorageArray*> _changed_storage_arrays;
 
static std::set<BaseStorageArray*> *_changed_storage_arrays = new std::set<BaseStorageArray*>;
 

	
 
/**
 
 * Remove references to use.
 
 */
 
BaseStorageArray::~BaseStorageArray()
 
{
 
	_changed_storage_arrays.erase(this);
 
	_changed_storage_arrays->erase(this);
 
}
 

	
 
/**
 
@@ -36,7 +36,7 @@ BaseStorageArray::~BaseStorageArray()
 
 */
 
void AddChangedStorage(BaseStorageArray *storage)
 
{
 
	_changed_storage_arrays.insert(storage);
 
	_changed_storage_arrays->insert(storage);
 
}
 

	
 
/**
 
@@ -52,10 +52,10 @@ void AddChangedStorage(BaseStorageArray 
 
void ClearStorageChanges(bool keep_changes)
 
{
 
	/* Loop over all changes arrays */
 
	for (std::set<BaseStorageArray*>::iterator it = _changed_storage_arrays.begin(); it != _changed_storage_arrays.end(); it++) {
 
	for (std::set<BaseStorageArray*>::iterator it = _changed_storage_arrays->begin(); it != _changed_storage_arrays->end(); it++) {
 
		(*it)->ClearChanges(keep_changes);
 
	}
 

	
 
	/* And then clear that array */
 
	_changed_storage_arrays.clear();
 
	_changed_storage_arrays->clear();
 
}
0 comments (0 inline, 0 general)