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 17aca5b38eb27921b9aea148f83dce1e7a9f49e9..d7df6bc374a91374c7d02c6a017c10d203b9350c 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 487fd5f16ee133ad06940c51fdfe9cb35b8875c0..ca3b959b379b31bef531743fe187ac2caad53158 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 ccc350662b6122ce7373f9733678ed99c771abbf..9f2a75ab605823a3c398c1509a4a73c7bfc1f026 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: