From c1303d98c3f73a9911d2b456300db33e98a38aff Mon Sep 17 00:00:00 2001 From: BigBahss Date: Mon, 15 Feb 2021 21:21:07 -0500 Subject: [PATCH] Scriptapi: fix segfault in shift(), add missing flag to the caller of shift() --- src/mainwindow_scriptapi.cpp | 2 +- src/ui/mappixmapitem.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mainwindow_scriptapi.cpp b/src/mainwindow_scriptapi.cpp index 43d0bfc1..6fa61340 100644 --- a/src/mainwindow_scriptapi.cpp +++ b/src/mainwindow_scriptapi.cpp @@ -149,7 +149,7 @@ void MainWindow::magicFillFromSelection(int x, int y, bool forceRedraw, bool com void MainWindow::shift(int xDelta, int yDelta, bool forceRedraw, bool commitChanges) { if (!this->editor || !this->editor->map) return; - this->editor->map_item->shift(xDelta, yDelta); + this->editor->map_item->shift(xDelta, yDelta, true); this->tryCommitMapChanges(commitChanges); this->tryRedrawMapArea(forceRedraw); } diff --git a/src/ui/mappixmapitem.cpp b/src/ui/mappixmapitem.cpp index 35aa9e10..e7f82bb0 100644 --- a/src/ui/mappixmapitem.cpp +++ b/src/ui/mappixmapitem.cpp @@ -76,7 +76,7 @@ void MapPixmapItem::shift(QGraphicsSceneMouseEvent *event) { } void MapPixmapItem::shift(int xDelta, int yDelta, bool fromScriptCall) { - Blockdata oldMetatiles = !fromScriptCall ? map->layout->blockdata : Blockdata(); + Blockdata oldMetatiles = map->layout->blockdata; for (int i = 0; i < map->getWidth(); i++) for (int j = 0; j < map->getHeight(); j++) {