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 () {
Clear();
}
void AssDialogue::Clear () {
ClearBlocks();
delete_clear(Blocks);
}
void AssDialogue::ClearBlocks() {
for (std::vector<AssDialogueBlock*>::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) {
delete *cur;
}
Blocks.clear();
delete_clear(Blocks);
}
bool AssDialogue::Parse(wxString rawData, int version) {

View file

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

View file

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

View file

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