changeset 258:a7ab511107fa

Ensure that file load is actually cancelled when user hits Cancel! (fixing SV bug #487)
author Chris Cannam
date Fri, 22 Jun 2012 09:26:09 +0100
parents 368b1f7c7325
children 7ee215c095dd
files framework/MainWindowBase.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Fri May 25 14:17:38 2012 +0100
+++ b/framework/MainWindowBase.cpp	Fri Jun 22 09:26:09 2012 +0100
@@ -1221,9 +1221,16 @@
     bool loadedTemplate = false;
 
     if (mode == ReplaceSession) {
+
+        if (!checkSaveModified()) return FileOpenCancelled;
+
         std::cerr << "SV looking for template " << templateName << std::endl;
         if (templateName != "") {
             FileOpenStatus tplStatus = openSessionTemplate(templateName);
+            if (tplStatus == FileOpenCancelled) {
+                std::cerr << "Template load cancelled" << std::endl;
+                return FileOpenCancelled;
+            }
             if (tplStatus != FileOpenFailed) {
                 std::cerr << "Template load succeeded" << std::endl;
                 loadedTemplate = true;