fixed memory leak

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@44 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-20 14:28:28 +00:00
parent 20f0efacd7
commit 79756cc36f
+3 -1
View File
@@ -28,8 +28,10 @@ ActionStack::~ActionStack() {
void ActionStack::add(Action* action, bool allow_merge) {
if (!action) return; // no action
action->perform(false); // TODO: delete action if perform throws
redo_actions.clear();
tellListeners(*action, false);
// clear redo list
FOR_EACH(a, redo_actions) delete a;
redo_actions.clear();
// try to merge?
if (allow_merge && !undo_actions.empty() && undo_actions.back()->merge(action)) {
// merged with top undo action