Don't call CompressForStack on copied AssFiles as the parsed data isn't copied in the first place.

Originally committed to SVN as r4671.
This commit is contained in:
Thomas Goyne 2010-07-11 03:31:19 +00:00
parent 4897f35dfc
commit 002aad0b29
4 changed files with 2 additions and 23 deletions

View file

@ -108,18 +108,11 @@ AssDialogue::AssDialogue(wxString _data,int version)
} }
AssDialogue::~AssDialogue () { AssDialogue::~AssDialogue () {
Clear(); delete_clear(Blocks);
}
void AssDialogue::Clear () {
ClearBlocks();
} }
void AssDialogue::ClearBlocks() { void AssDialogue::ClearBlocks() {
for (std::vector<AssDialogueBlock*>::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) { delete_clear(Blocks);
delete *cur;
}
Blocks.clear();
} }
bool AssDialogue::Parse(wxString rawData, int version) { bool AssDialogue::Parse(wxString rawData, int version) {

View file

@ -220,9 +220,6 @@ public:
const wxString GetEntryData() const; const wxString GetEntryData() const;
/// Do nothing /// Do nothing
void SetEntryData(wxString) { } void SetEntryData(wxString) { }
/// Synonym for ClearBlocks
void Clear();
/// @brief Set a margin /// @brief Set a margin
/// @param value New value of the margin /// @param value New value of the margin

View file

@ -766,20 +766,12 @@ wxString AssFile::GetWildcardList(int mode) {
else return _T(""); else return _T("");
} }
void AssFile::CompressForStack() {
for (entryIter cur=Line.begin();cur!=Line.end();cur++) {
AssDialogue *diag = dynamic_cast<AssDialogue*>(*cur);
if (diag) diag->ClearBlocks();
}
}
int AssFile::Commit(wxString desc, int amendId) { int AssFile::Commit(wxString desc, int amendId) {
++commitId; ++commitId;
// Allow coalescing only if it's the last change and the file has not been // Allow coalescing only if it's the last change and the file has not been
// saved since the last change // saved since the last change
if (commitId == amendId+1 && RedoStack.empty() && savedCommitId != commitId) { if (commitId == amendId+1 && RedoStack.empty() && savedCommitId != commitId) {
UndoStack.back() = *this; UndoStack.back() = *this;
UndoStack.back().CompressForStack();
return commitId; return commitId;
} }
@ -788,7 +780,6 @@ int AssFile::Commit(wxString desc, int amendId) {
// Place copy on stack // Place copy on stack
undoDescription = desc; undoDescription = desc;
UndoStack.push_back(*this); UndoStack.push_back(*this);
UndoStack.back().CompressForStack();
// Cap depth // Cap depth
int depth = OPT_GET("Limits/Undo Levels")->GetInt(); int depth = OPT_GET("Limits/Undo Levels")->GetInt();

View file

@ -88,8 +88,6 @@ public:
/// Clear the file /// Clear the file
void Clear(); void Clear();
/// Discard some parsed data to reduce the size of the undo stack
void CompressForStack();
/// @brief Load default file /// @brief Load default file
/// @param defline Add a blank line to the file /// @param defline Add a blank line to the file
void LoadDefault(bool defline=true); void LoadDefault(bool defline=true);