# HG changeset patch # User Santeri Piippo # Date 1389182230 -7200 # Node ID 487db37f0bb3453068569c9963ee3d51f16fb041 # Parent 353e418f161a74aa3d271c9fe6d3afcda8b1d936 - 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... diff -r 353e418f161a -r 487db37f0bb3 src/document.cc --- 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);