diff --git a/map.h b/map.h index f2e1ff2d..8c3ecaa4 100755 --- a/map.h +++ b/map.h @@ -21,6 +21,9 @@ public: this->layoutWidth = layoutWidth_; this->layoutHeight = layoutHeight_; } + ~HistoryItem() { + if (metatiles) delete metatiles; + } }; template @@ -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;