Fix memory leak when going back in edit/undo history
This commit is contained in:
parent
0b8c71119d
commit
0b07ea63cb
1 changed files with 5 additions and 0 deletions
5
map.h
5
map.h
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue