diff main/MainWindow.cpp @ 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 a6cbec451508
children e583f57f1311
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;
 }