Fix memory leak when going back in edit/undo history

This commit is contained in:
Marcus Huderle 2018-09-14 18:37:41 -05:00
parent 0b8c71119d
commit 0b07ea63cb

5
map.h
View file

@ -21,6 +21,9 @@ public:
this->layoutWidth = layoutWidth_;
this->layoutHeight = layoutHeight_;
}
~HistoryItem() {
if (metatiles) delete metatiles;
}
};
template <typename T>
@ -43,7 +46,9 @@ public:
}
void push(T commit) {
while (head + 1 < history.length()) {
HistoryItem *item = history.last();
history.removeLast();
delete item;
}
if (saved > head) {
saved = -1;