From: Georg Baum Date: Sat, 2 Jul 2016 16:58:30 +0000 (+0200) Subject: Fix CAS input on windows (bug 10262) X-Git-Tag: 2.3.0alpha1~1359 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6dfc255088ecd3393c4c5dc3d2c5357a3fbabfc0;p=features.git 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. --- diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp index b3443fa919..8b1e0f0c8d 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(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;