From: Philipp Spitzer Date: Tue, 28 May 2013 18:23:49 +0000 (+0000) Subject: Made sure the mainwindow is destroyed properly and the sql database is closed. X-Git-Tag: 0.6.0~10 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/4d8493b7dc93408e861af0a77e9ae1a0ab333d2b Made sure the mainwindow is destroyed properly and the sql database is closed. --- 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: