diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 67821c720..9fc9eb338 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -47,7 +47,8 @@ MainWindow::MainWindow() : mApplications(new ApplicationList(this)), mTranslation(new TranslationHandler(this)), mLanguages(new QActionGroup(this)), - mLogView(NULL) + mLogView(NULL), + mExiting(false) { mUI.setupUi(this); mUI.mResults->Initialize(mSettings, mApplications); @@ -399,6 +400,12 @@ QStringList MainWindow::RemoveUnacceptedFiles(const QStringList &list) void MainWindow::CheckDone() { + if (mExiting) + { + close(); + return; + } + mUI.mResults->CheckingFinished(); EnableCheckButtons(true); mUI.mActionSettings->setEnabled(true); @@ -522,10 +529,9 @@ void MainWindow::closeEvent(QCloseEvent *event) // exiting it doesn't matter. mThread->Stop(); SaveSettings(); - event->accept(); + mExiting = true; } - else - event->ignore(); + event->ignore(); } } diff --git a/gui/mainwindow.h b/gui/mainwindow.h index f37cc9b67..f49d6d3e5 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -343,6 +343,15 @@ protected: */ LogView *mLogView; +private: + + /** + * @brief Are we exiting the cppcheck? + * If this is true then the cppcheck is waiting for check threads to exit + * so that the application can be closed. + */ + bool mExiting; + }; /// @} #endif // MAINWINDOW_H