diff framework/MainWindowBase.cpp @ 720:55f317633b93

Fix failure to notice we are no longer opening an audio file, if user cancels the save-modified dialog. This led to refusal to respect the close button on the main window.
author Chris Cannam
date Fri, 06 Dec 2019 13:09:29 +0000
parents ec8f21a20fa7
children 453029d6e9bf
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Thu Nov 21 14:28:47 2019 +0000
+++ b/framework/MainWindowBase.cpp	Fri Dec 06 13:09:29 2019 +0000
@@ -1582,7 +1582,10 @@
     }
 
     auto newModelId = ModelById::add(newModel);
-    return addOpenedAudioModel(source, newModelId, mode, templateName, true);
+    auto status = addOpenedAudioModel
+        (source, newModelId, mode, templateName, true);
+    m_openingAudioFile = false;
+    return status;
 }
 
 MainWindowBase::FileOpenStatus
@@ -1666,13 +1669,17 @@
 
     if (mode == ReplaceSession) {
 
-        if (!checkSaveModified()) return FileOpenCancelled;
+        if (!checkSaveModified()) {
+            m_openingAudioFile = false;
+            return FileOpenCancelled;
+        }
 
         SVDEBUG << "SV looking for template " << templateName << endl;
         if (templateName != "") {
             FileOpenStatus tplStatus = openSessionTemplate(templateName);
             if (tplStatus == FileOpenCancelled) {
                 SVDEBUG << "Template load cancelled" << endl;
+                m_openingAudioFile = false;
                 return FileOpenCancelled;
             }
             if (tplStatus != FileOpenFailed) {