diff --git a/cockatrice/src/client/ui/widgets/cards/card_info_picture_widget.cpp b/cockatrice/src/client/ui/widgets/cards/card_info_picture_widget.cpp index c84f6a7d5..03766d1b4 100644 --- a/cockatrice/src/client/ui/widgets/cards/card_info_picture_widget.cpp +++ b/cockatrice/src/client/ui/widgets/cards/card_info_picture_widget.cpp @@ -40,6 +40,7 @@ CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool _hoverT enlargedPixmapWidget = new CardInfoPictureEnlargedWidget(this->window()); enlargedPixmapWidget->hide(); + connect(this, &QObject::destroyed, enlargedPixmapWidget, &CardInfoPictureEnlargedWidget::deleteLater); hoverTimer = new QTimer(this); hoverTimer->setSingleShot(true); @@ -63,14 +64,6 @@ CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool _hoverT }); } -CardInfoPictureWidget::~CardInfoPictureWidget() -{ - if (enlargedPixmapWidget) { - enlargedPixmapWidget->hide(); - enlargedPixmapWidget->deleteLater(); - } -} - /** * @brief Sets the card to be displayed and updates the pixmap. * @param card A shared pointer to the card information (CardInfoPtr). diff --git a/cockatrice/src/client/ui/widgets/cards/card_info_picture_widget.h b/cockatrice/src/client/ui/widgets/cards/card_info_picture_widget.h index 7de144a80..859251c9f 100644 --- a/cockatrice/src/client/ui/widgets/cards/card_info_picture_widget.h +++ b/cockatrice/src/client/ui/widgets/cards/card_info_picture_widget.h @@ -21,7 +21,6 @@ public: explicit CardInfoPictureWidget(QWidget *parent = nullptr, bool hoverToZoomEnabled = false, bool raiseOnEnter = false); - ~CardInfoPictureWidget(); ExactCard getCard() { return exactCard;