commit cd046f0e0cdea5aae064284790e4e17f0c60bd03
Author: Enrico Forestieri <[email protected]>
Date:   Tue Jun 23 02:39:48 2015 +0200

    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.

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

Reply via email to