From 21ae0fc658896e017ca83c8ea81058fda0576514 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 8 Mar 2005 21:39:01 +0000 Subject: [PATCH] don't delete current Song's steps through the LastSaved when destructing ScreenEdit --- stepmania/src/ScreenEdit.cpp | 3 +++ stepmania/src/Song.cpp | 7 +++++++ stepmania/src/song.h | 1 + 3 files changed, 11 insertions(+) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 3162d18534..83cc2a4474 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -613,6 +613,9 @@ void ScreenEdit::Init() ScreenEdit::~ScreenEdit() { + // UGLY: Don't delete the Song's steps. + m_songLastSave.DetachSteps(); + LOG->Trace( "ScreenEdit::~ScreenEdit()" ); m_soundMusic.StopPlaying(); } diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index cf3d5469b2..f214b29193 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -85,6 +85,13 @@ Song::~Song() // that all pointers to this Song and its Steps are invalidated. } +void Song::DetachSteps() +{ + m_vpSteps.clear(); + FOREACH_StepsType( st ) + m_vpStepsByType[st].clear(); +} + /* Reset to an empty song. */ void Song::Reset() { diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 457be50613..736f58f73f 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -59,6 +59,7 @@ public: Song(); ~Song(); void Reset(); + void DetachSteps(); NotesLoader *MakeLoader( CString sDir ) const;