Skip to content

Commit

Permalink
fixed crash on force exit in relog form
Browse files Browse the repository at this point in the history
  • Loading branch information
benapetr committed Jul 19, 2024
1 parent 4c6743f commit 30e8c60
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/huggle_ui/reloginform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "uigeneric.hpp"
#include "ui_reloginform.h"

bool program_terminated = false;

using namespace Huggle;
ReloginForm::ReloginForm(WikiSite *site, QWidget *parent) : QDialog(parent), ui(new Ui::ReloginForm)
{
Expand All @@ -48,6 +50,7 @@ ReloginForm::~ReloginForm()

void Huggle::ReloginForm::on_pushButton_clicked()
{
program_terminated = true;
MainWindow::HuggleMain->ShutdownForm();
Core::HuggleCore->Shutdown();
}
Expand Down Expand Up @@ -182,6 +185,13 @@ void ReloginForm::Localize()

void ReloginForm::reject()
{
if (program_terminated)
{
// At this point touching any configuration or core structures is unsafe as we performed emergency shutdown previous step
QDialog::reject();
return;
}

// We store it when we destroy the window because sometimes user wants to cancel the login and also prevent it
// from auto-relogging you (especially if stored pw is wrong). So this way it's possible.
hcfg->SystemConfig_Autorelog = this->ui->checkBox->isChecked();
Expand Down

0 comments on commit 30e8c60

Please sign in to comment.