changeset 490:bc04d651f8a4

Ensure all windows are closed when the main one is (thus exiting the application even if some other windows were still open)
author Chris Cannam
date Thu, 19 Jan 2012 15:36:59 +0000
parents 073733da4b6c
children abbd15ead43d
files main/MainWindow.cpp main/MainWindow.h
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Thu Jan 19 14:44:35 2012 +0000
+++ b/main/MainWindow.cpp	Thu Jan 19 15:36:59 2012 +0000
@@ -149,6 +149,7 @@
     m_soloAction(0),
     m_soloModified(false),
     m_prevSolo(false),
+    m_exiting(false),
     m_rwdStartAction(0),
     m_rwdSimilarAction(0),
     m_rwdAction(0),
@@ -2989,6 +2990,11 @@
 void
 MainWindow::closeEvent(QCloseEvent *e)
 {
+    if (m_exiting) {
+        e->accept();
+        return;
+    }
+
 //    SVDEBUG << "MainWindow::closeEvent" << endl;
 
     if (m_openingAudioFile) {
@@ -3021,6 +3027,10 @@
     closeSession();
 
     e->accept();
+
+    m_exiting = true;
+    qApp->closeAllWindows();
+    
     return;
 }
 
--- a/main/MainWindow.h	Thu Jan 19 14:44:35 2012 +0000
+++ b/main/MainWindow.h	Thu Jan 19 15:36:59 2012 +0000
@@ -218,6 +218,8 @@
     bool                     m_soloModified;
     bool                     m_prevSolo;
 
+    bool                     m_exiting;
+
     QFrame                  *m_playControlsSpacer;
     int                      m_playControlsWidth;