Fix use-after-free in CommandZone teardown by disconnecting signals before member destruction

This commit is contained in:
DawnFire42 2026-07-09 14:21:04 -04:00
parent e447542957
commit e4d50cf731
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
2 changed files with 8 additions and 0 deletions

View file

@ -24,6 +24,13 @@ CommandZone::CommandZone(CommandZoneLogic *_logic, int _zoneHeight, QGraphicsIte
setupClipContainer(ZValues::CARD_BASE); setupClipContainer(ZValues::CARD_BASE);
} }
CommandZone::~CommandZone()
{
for (AbstractCounter *ctr : taxCounters) {
disconnect(ctr, &QObject::destroyed, this, nullptr);
}
}
void CommandZone::updateBg() void CommandZone::updateBg()
{ {
update(); update();

View file

@ -62,6 +62,7 @@ public:
* @param parent Parent graphics item * @param parent Parent graphics item
*/ */
CommandZone(CommandZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent); CommandZone(CommandZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent);
~CommandZone() override;
/** /**
* @brief Handles card drops, calculating insertion position from drop point. * @brief Handles card drops, calculating insertion position from drop point.