changeset 500:032deed8b35b

Connect quit function directly to closeAllWindows rather than try to closeAllWindows from close() (which strangely hangs on Windows)
author Chris Cannam
date Mon, 30 Jan 2012 16:56:39 +0000
parents d2a58dfc3ae5
children 173325440b8e
files main/MainWindow.cpp main/MainWindow.h
diffstat 2 files changed, 4 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Mon Jan 30 16:06:47 2012 +0000
+++ b/main/MainWindow.cpp	Mon Jan 30 16:56:39 2012 +0000
@@ -149,7 +149,6 @@
     m_soloAction(0),
     m_soloModified(false),
     m_prevSolo(false),
-    m_exiting(false),
     m_rwdStartAction(0),
     m_rwdSimilarAction(0),
     m_rwdAction(0),
@@ -576,7 +575,7 @@
                          tr("&Quit"), this);
     action->setShortcut(tr("Ctrl+Q"));
     action->setStatusTip(tr("Exit Sonic Visualiser"));
-    connect(action, SIGNAL(triggered()), this, SLOT(close()));
+    connect(action, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
     m_keyReference->registerShortcut(action);
     menu->addAction(action);
 }
@@ -3038,12 +3037,7 @@
 void
 MainWindow::closeEvent(QCloseEvent *e)
 {
-    if (m_exiting) {
-        e->accept();
-        return;
-    }
-
-//    SVDEBUG << "MainWindow::closeEvent" << endl;
+//    std::cerr << "MainWindow::closeEvent" << std::endl;
 
     if (m_openingAudioFile) {
 //        std::cerr << "Busy - ignoring close event" << std::endl;
@@ -3052,7 +3046,7 @@
     }
 
     if (!m_abandoning && !checkSaveModified()) {
-//        SVDEBUG << "Ignoring close event" << endl;
+//        std::cerr << "Close refused by user - ignoring close event" << endl;
 	e->ignore();
 	return;
     }
@@ -3076,9 +3070,6 @@
 
     e->accept();
 
-    m_exiting = true;
-    qApp->closeAllWindows();
-    
     return;
 }
 
@@ -3437,7 +3428,7 @@
 	LayerFactory::LayerTypeSet emptyTypes =
 	    LayerFactory::getInstance()->getValidEmptyLayerTypes();
 
-	Layer *newLayer;
+	Layer *newLayer = 0;
 
 	if (emptyTypes.find(type) != emptyTypes.end()) {
 
--- a/main/MainWindow.h	Mon Jan 30 16:06:47 2012 +0000
+++ b/main/MainWindow.h	Mon Jan 30 16:56:39 2012 +0000
@@ -230,8 +230,6 @@
     bool                     m_soloModified;
     bool                     m_prevSolo;
 
-    bool                     m_exiting;
-
     QFrame                  *m_playControlsSpacer;
     int                      m_playControlsWidth;