mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-25 09:15:34 -05:00
Fix memory leak when going back in edit/undo history
This commit is contained in:
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;
|
||||
|
||||
Reference in New Issue
Block a user