From 2e6f5d1ed7ffd22400b77d86f51f5288d306629b Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 18 May 2022 17:38:56 -0400 Subject: [PATCH] In ModuleWidget::removeAction() unset module position from rack and push to history. --- src/app/ModuleWidget.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/ModuleWidget.cpp b/src/app/ModuleWidget.cpp index 76651c28..d2cc2d1b 100644 --- a/src/app/ModuleWidget.cpp +++ b/src/app/ModuleWidget.cpp @@ -886,16 +886,23 @@ void ModuleWidget::bypassAction(bool bypassed) { } void ModuleWidget::removeAction() { - history::ComplexAction* complexAction = new history::ComplexAction; - complexAction->name = "delete module"; - appendDisconnectActions(complexAction); + history::ComplexAction* h = new history::ComplexAction; + h->name = "delete module"; + + // Disconnect cables + appendDisconnectActions(h); + + // Unset module position from rack. + APP->scene->rack->updateModuleOldPositions(); + APP->scene->rack->forceUnsetModulePos(this); + h->push(APP->scene->rack->getModuleDragAction()); // history::ModuleRemove history::ModuleRemove* moduleRemove = new history::ModuleRemove; moduleRemove->setModule(this); - complexAction->push(moduleRemove); + h->push(moduleRemove); - APP->history->push(complexAction); + APP->history->push(h); // This removes the module and transfers ownership to caller APP->scene->rack->removeModule(this);