Skip to content

Commit

Permalink
general: fix crash on exit at license menu
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Popa <[email protected]>
  • Loading branch information
andrei47w committed Nov 22, 2024
1 parent f8dace7 commit a04d921
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion core/src/licenseoverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <QAbstractButton>
#include <QCoreApplication>
#include <style.h>

#include <licenseoverlay.h>
#include <pluginbase/preferences.h>
Expand All @@ -40,12 +41,15 @@ LicenseOverlay::LicenseOverlay(QWidget *parent)
connect(m_popupWidget->getContinueBtn(), &QAbstractButton::clicked, [&]() {
Preferences::GetInstance()->set("general_first_run", false);
deleteLater();
m_popupWidget->deleteLater();
});
Preferences::connect(m_popupWidget->getExitBtn(), &QAbstractButton::clicked,
[&]() { QCoreApplication::quit(); });

Style::setBackgroundColor(m_popupWidget, json::theme::background_primary);
}

LicenseOverlay::~LicenseOverlay() { delete m_popupWidget; }
LicenseOverlay::~LicenseOverlay() {}

void LicenseOverlay::showOverlay()
{
Expand Down
9 changes: 7 additions & 2 deletions gui/src/widgets/popupwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ PopupWidget::PopupWidget(QWidget *parent)
m_continueButton->setFocus();
}

PopupWidget::~PopupWidget() { delete m_tintedOverlay; }
PopupWidget::~PopupWidget()
{
if(m_tintedOverlay != nullptr) {
m_tintedOverlay->deleteLater();
}
}

void PopupWidget::initUI()
{
Expand Down Expand Up @@ -122,7 +127,7 @@ void PopupWidget::enableTintedOverlay(bool enable)
m_tintedOverlay->show();
raise();
show();
} else {
} else if(m_tintedOverlay != nullptr) {
delete m_tintedOverlay;
m_tintedOverlay = nullptr;
}
Expand Down

0 comments on commit a04d921

Please sign in to comment.