deep copy to fix crash reverting in editor

This commit is contained in:
Chris Danford
2005-06-04 23:16:27 +00:00
parent 3b61a74477
commit 23ed01fffe
2 changed files with 9 additions and 10 deletions
+4 -8
View File
@@ -51,8 +51,8 @@ const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
Song::Song()
{
FOREACH_BackgroundLayer( i )
m_BackgroundChanges[i] = new vector<BackgroundChange>;
m_ForegroundChanges = new vector<BackgroundChange>;
m_BackgroundChanges[i] = AutoPtrCopyOnWrite<VBackgroundChange>(new VBackgroundChange);
m_ForegroundChanges = AutoPtrCopyOnWrite<VBackgroundChange>(new VBackgroundChange);
m_LoadedFromProfile = PROFILE_SLOT_INVALID;
@@ -72,10 +72,6 @@ Song::Song()
Song::~Song()
{
FOREACH_BackgroundLayer( i )
SAFE_DELETE( m_BackgroundChanges[i] );
SAFE_DELETE( m_ForegroundChanges );
FOREACH( Steps*, m_vpSteps, s )
SAFE_DELETE( *s );
m_vpSteps.clear();
@@ -1223,7 +1219,7 @@ const vector<BackgroundChange> &Song::GetBackgroundChanges( BackgroundLayer bl )
}
vector<BackgroundChange> &Song::GetBackgroundChanges( BackgroundLayer bl )
{
return *(m_BackgroundChanges[bl]);
return *(m_BackgroundChanges[bl].Get());
}
const vector<BackgroundChange> &Song::GetForegroundChanges() const
@@ -1232,7 +1228,7 @@ const vector<BackgroundChange> &Song::GetForegroundChanges() const
}
vector<BackgroundChange> &Song::GetForegroundChanges()
{
return *m_ForegroundChanges;
return *m_ForegroundChanges.Get();
}