Made sure the mainwindow is destroyed properly and the sql database is closed.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Tue, 28 May 2013 18:23:49 +0000 (18:23 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Tue, 28 May 2013 18:23:49 +0000 (18:23 +0000)
src/app/main.cpp
src/gui/mainwindow.cpp
src/gui/mainwindow.h

index 17aca5b..d7df6bc 100644 (file)
@@ -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();
 }
index 487fd5f..ca3b959 100644 (file)
@@ -127,6 +127,11 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
 }
 
 
+MainWindow::~MainWindow() {
+    sqlEngine->close();
+}
+
+
 void MainWindow::on_aboutAction_triggered()
 {
     QDialog dialog(this);
index ccc3506..9f2a75a 100644 (file)
@@ -35,6 +35,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
     Q_OBJECT
 public:
     MainWindow(QWidget *parent = 0);
+    ~MainWindow();
 signals:
     void conferenceRemoved();
 private slots: