Wed, 08 Jan 2014 13:57:10 +0200
- if loading another file to replace an explicitly loaded file, this file won't get closed automatically and thus needs to be manually closed. We also need to check that it's safe to close before doing this. Also fixed a rather argh problem with ::save not using the proper path...
src/document.cc | file | annotate | diff | comparison | revisions |
--- 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);