src/document.cc

changeset 608
487db37f0bb3
parent 607
353e418f161a
child 609
a8dc74a809c6
--- a/src/document.cc	Wed Jan 08 13:43:39 2014 +0200
+++ b/src/document.cc	Wed Jan 08 13:57:10 2014 +0200
@@ -640,6 +640,14 @@
 		}
 	}
 
+	// We cannot open this file if the document this would replace is not
+	// safe to close.
+	if (documentToReplace != null && documentToReplace->isSafeToClose() == false)
+	{
+		g_loadingMainFile = false;
+		return;
+	}
+
 	LDDocument* file = openDocument (path, false);
 
 	if (!file)
@@ -672,6 +680,7 @@
 		}
 
 		assert (documentToReplace->countReferences() == 0);
+		delete documentToReplace;
 	}
 
 	// If we have an anonymous, unchanged file open as the only open file
@@ -692,7 +701,7 @@
 bool LDDocument::save (QString savepath)
 {
 	if (!savepath.length())
-		savepath = getName();
+		savepath = getFullPath();
 
 	File f (savepath, File::Write);
 

mercurial