From 4d8493b7dc93408e861af0a77e9ae1a0ab333d2b Mon Sep 17 00:00:00 2001 From: Philipp Spitzer Date: Tue, 28 May 2013 18:23:49 +0000 Subject: [PATCH] Made sure the mainwindow is destroyed properly and the sql database is closed. --- src/app/main.cpp | 6 +++--- src/gui/mainwindow.cpp | 5 +++++ src/gui/mainwindow.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 17aca5b..d7df6bc 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -38,16 +38,16 @@ int main(int argc, char *argv[]) QCoreApplication::setApplicationName("ConfClerk"); QCoreApplication::setApplicationVersion(VERSION); - QWidget* window = new MainWindow; + MainWindow window; // If we were started with the parameters confernceid and eventid, show the corresponding event (alarm) if (argc >= 3) { QString conferenceIdStr = argv[1]; QString eventIdStr = argv[2]; - EventDialog dialog(conferenceIdStr.toInt(), eventIdStr.toInt(), window); + EventDialog dialog(conferenceIdStr.toInt(), eventIdStr.toInt(), &window); dialog.exec(); } - window->show(); + window.show(); return a.exec(); } diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 487fd5f..ca3b959 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -127,6 +127,11 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) { } +MainWindow::~MainWindow() { + sqlEngine->close(); +} + + void MainWindow::on_aboutAction_triggered() { QDialog dialog(this); diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index ccc3506..9f2a75a 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -35,6 +35,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow Q_OBJECT public: MainWindow(QWidget *parent = 0); + ~MainWindow(); signals: void conferenceRemoved(); private slots: -- 2.39.5