From 16fedf3592d5d47d5b0bdfef9cd87b7a3f20f17b Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Fri, 17 Mar 2017 12:56:39 +0100 Subject: [PATCH] Fixed crash when close main window. --- application/mainwindow.cpp | 6 ++++++ application/mainwindow.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/application/mainwindow.cpp b/application/mainwindow.cpp index a03046b..989eb1d 100644 --- a/application/mainwindow.cpp +++ b/application/mainwindow.cpp @@ -133,6 +133,12 @@ void MainWindow::showEvent(QShowEvent *evt) } } +void MainWindow::closeEvent(QCloseEvent *evt) +{ + Context::instance().destroy(); + evt->accept(); +} + void MainWindow::on_actionSettings_triggered() { SettingsForm *settings = new SettingsForm(this); diff --git a/application/mainwindow.h b/application/mainwindow.h index 220ef84..305ab1b 100644 --- a/application/mainwindow.h +++ b/application/mainwindow.h @@ -3,6 +3,7 @@ #include #include +#include #include "logindialog.h" @@ -40,6 +41,7 @@ private: // QWidget interface protected: void showEvent(QShowEvent *evt); + void closeEvent(QCloseEvent *evt) override; }; #endif // MAINWINDOW_H