diff framework/MainWindowBase.cpp @ 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 f3f9e3d647c1
children 7ee215c095dd
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;