]> git.lyx.org Git - lyx.git/commitdiff
Fix CAS input on windows (bug 10262)
authorGeorg Baum <baum@lyx.org>
Sat, 2 Jul 2016 16:58:30 +0000 (18:58 +0200)
committerGeorg Baum <baum@lyx.org>
Sat, 2 Jul 2016 16:58:30 +0000 (18:58 +0200)
This is the well known file locking problem: The TempFile class keeps the
created file locked for the own process, and this prevents the CAS to read it.

src/mathed/MathExtern.cpp

index b3443fa919a5d096bff0b44636b54e9f921903c2..8b1e0f0c8d52a861f50f05edec7611db4ec8d982 100644 (file)
@@ -1001,8 +1001,13 @@ namespace {
        {
                // In order to avoid parsing problems with command interpreters
                // we pass input data through a file
-               TempFile tempfile("casinput");
-               FileName const cas_tmpfile = tempfile.name();
+               // Since the CAS is supposed to read the temp file we need
+               // to unlock it on windows (bug 10262).
+               unique_ptr<TempFile> tempfile(new TempFile("casinput"));
+               tempfile->setAutoRemove(false);
+               FileName const cas_tmpfile = tempfile->name();
+               tempfile.reset();
+
                if (cas_tmpfile.empty()) {
                        lyxerr << "Warning: cannot create temporary file."
                               << endl;