commit 6dfc255088ecd3393c4c5dc3d2c5357a3fbabfc0 Author: Georg Baum <b...@lyx.org> Date: Sat Jul 2 18:58:30 2016 +0200
Fix CAS input on windows (bug 10262) 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 | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp index b3443fa..8b1e0f0 100644 --- a/src/mathed/MathExtern.cpp +++ b/src/mathed/MathExtern.cpp @@ -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;