X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathExtern.cpp;h=182a00971f1b57a90610d7dc71b8f27790751539;hb=5d7dae9e382f0b01800f5652e673e12fa6923740;hp=b3443fa919a5d096bff0b44636b54e9f921903c2;hpb=3c6f2427c35064cd248ed2ca0482e6ea30b4d609;p=lyx.git diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp index b3443fa919..182a00971f 100644 --- a/src/mathed/MathExtern.cpp +++ b/src/mathed/MathExtern.cpp @@ -896,6 +896,10 @@ void extractDiff(MathData & ar) int mult = 1; if (extractNumber(script->up(), mult)) { //lyxerr << "mult: " << mult << endl; + if (mult < 0 || mult > 1000) { + lyxerr << "Cannot differentiate less than 0 or more than 1000 times !" << endl; + continue; + } for (int i = 0; i < mult; ++i) diff->addDer(MathData(buf, dt + 1, st)); } @@ -1001,8 +1005,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; @@ -1016,6 +1025,7 @@ namespace { lyxerr << "calling: " << cmd << "\ninput: '" << data << "'" << endl; cmd_ret const ret = runCommand(command); + cas_tmpfile.removeFile(); return ret.second; }