Avoid an exception when the lyxpreview2bitmap.py script fails completely

If latex fails to generate any output, the forked process was not removed.
Now, if a snippet was changed a new one was started but, if also the zoom was
changed, things went awry because the 2 concurrent processes were asked to
process again the same snippet. Previously this would have simply caused a
waste of resources because the changed snippet would have not been regenerated.
Also reset the guard due to the early exit.
This commit is contained in:
Enrico Forestieri 2015-06-23 02:39:48 +02:00
parent 592219c1f1
commit cd046f0e0c

View File

@ -746,6 +746,7 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval)
if (git == in_progress_.end()) { if (git == in_progress_.end()) {
lyxerr << "PreviewLoader::finishedGenerating(): unable to find " lyxerr << "PreviewLoader::finishedGenerating(): unable to find "
"data for PID " << pid << endl; "data for PID " << pid << endl;
finished_generating_ = true;
return; return;
} }
@ -754,8 +755,11 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval)
LYXERR(Debug::GRAPHICS, "PreviewLoader::finishedInProgress(" LYXERR(Debug::GRAPHICS, "PreviewLoader::finishedInProgress("
<< retval << "): processing " << status << retval << "): processing " << status
<< " for " << command); << " for " << command);
if (retval > 0) if (retval > 0) {
in_progress_.erase(git);
finished_generating_ = true;
return; return;
}
// Read the metrics file, if it exists // Read the metrics file, if it exists
vector<double> ascent_fractions(git->second.snippets.size()); vector<double> ascent_fractions(git->second.snippets.size());