Parent MoveMenu to CardMenu to fix memory leak on menu rebuild

This commit is contained in:
DawnFire42 2026-08-10 12:46:25 -04:00
parent 919b9d92ac
commit 3e90748f73
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
3 changed files with 7 additions and 7 deletions

View file

@ -203,7 +203,7 @@ void CardMenu::createTableMenu(bool canModifyCard)
}
addSeparator();
addAction(aClone);
addMenu(new MoveMenu(player));
addMenu(new MoveMenu(player, this));
addSeparator();
addAction(aAttach);
if (card->getAttachedTo()) {
@ -253,7 +253,7 @@ void CardMenu::createStackMenu(bool canModifyCard)
addAction(aPlayFacedown);
addSeparator();
addAction(aClone);
addMenu(new MoveMenu(player));
addMenu(new MoveMenu(player, this));
addSeparator();
addAction(aAttach);
addAction(aDrawArrow);
@ -282,7 +282,7 @@ void CardMenu::createGraveyardOrExileMenu(bool canModifyCard)
addAction(aPlayFacedown);
addSeparator();
addAction(aClone);
addMenu(new MoveMenu(player));
addMenu(new MoveMenu(player, this));
addSeparator();
addAction(aAttach);
addAction(aDrawArrow);
@ -320,7 +320,7 @@ void CardMenu::createHandOrCustomZoneMenu(bool canModifyCard)
addSeparator();
addAction(aClone);
addMenu(new MoveMenu(player));
addMenu(new MoveMenu(player, this));
// actions that are really wonky when done from deck or sideboard
if (card->getZone()->getName() == ZoneNames::HAND) {
@ -344,7 +344,7 @@ void CardMenu::createHandOrCustomZoneMenu(bool canModifyCard)
void CardMenu::createZonelessMenu(bool canModifyCard)
{
if (canModifyCard) {
addMenu(new MoveMenu(player));
addMenu(new MoveMenu(player, this));
}
}

View file

@ -6,7 +6,7 @@
#include "../card_menu_action_type.h"
#include "../player_graphics_item.h"
MoveMenu::MoveMenu(PlayerGraphicsItem *player) : QMenu(tr("Move to"))
MoveMenu::MoveMenu(PlayerGraphicsItem *player, QWidget *parent) : QMenu(tr("Move to"), parent)
{
aMoveToTopLibrary = new QAction(this);
aMoveToTopLibrary->setData(cmMoveToTopLibrary);

View file

@ -14,7 +14,7 @@ class MoveMenu : public QMenu
Q_OBJECT
public:
explicit MoveMenu(PlayerGraphicsItem *player);
explicit MoveMenu(PlayerGraphicsItem *player, QWidget *parent);
void setShortcutsActive();
void retranslateUi();