fix crash when a cardmenu becomes an orphan (#4682)

* fix crash when a cardmenu becomes an orphan

when a cardmenu is closed the cursor on that card reverts to the open
hand, this crashed the client when that card would be destroyed or moved
the act of reverting to the open hand now happens as an emitted signal,
this way it just doesn't exist anymore when the card is deleted.

* simplify fix
This commit is contained in:
ebbit1q 2022-10-17 22:38:44 +02:00 committed by GitHub
parent 527ac36129
commit 45cf08111a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -390,7 +390,8 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::RightButton) { if (event->button() == Qt::RightButton) {
if (cardMenu != nullptr && !cardMenu->isEmpty() && owner != nullptr) { if (cardMenu != nullptr && !cardMenu->isEmpty() && owner != nullptr) {
cardMenu->exec(event->screenPos()); cardMenu->popup(event->screenPos());
return;
} }
} else if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) && } else if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
(!SettingsCache::instance().getDoubleClickToPlay())) { (!SettingsCache::instance().getDoubleClickToPlay())) {