commit 2a9f07336fca1c228827b762cbf7dd56cb68f0c8 Author: Enrico Forestieri <for...@lyx.org> Date: Thu Jun 25 21:04:42 2015 +0200
Fix crashes related to macros and instant preview * Fix crash when zooming after latex failed to generate any output for previews. This was new in 2.1.4, so no status line is needed. * Fix crash when copying macros with instant preview on. diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index eb25805..e20f1ad 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -709,6 +709,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; } @@ -717,8 +718,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()); diff --git a/src/mathed/MacroTable.h b/src/mathed/MacroTable.h index 3bd04ea..030e6f7 100644 --- a/src/mathed/MacroTable.h +++ b/src/mathed/MacroTable.h @@ -69,6 +69,8 @@ public: char const * MathMLtype() const; /// void setSymbol(latexkeys const * sym) { sym_ = sym; } + /// + DocIterator const & pos() { return pos_; } /// lock while being drawn to avoid recursions int lock() const { return ++lockCount_; } diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index 06cfd5c..a25c5db 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -176,6 +176,14 @@ void MathMacro::assign(MathMacro const & that) if (p) p->setOwner(this); } + if (macro_ && lyxrc.preview == LyXRC::PREVIEW_ON) { + // We need to update macro_ by ourselves because in this case + // MathData::metrics() is not called when selecting a math inset + DocIterator const & pos = macroBackup_.pos(); + macro_ = pos.buffer() ? pos.buffer()->getMacro(name(), pos) : 0; + if (!macro_) + macro_ = ¯oBackup_; + } } diff --git a/status.21x b/status.21x index 7b1ed0d..589b94c 100644 --- a/status.21x +++ b/status.21x @@ -183,6 +183,8 @@ What's new - Fix crash when copying macros with arguments (bug 9418). +- Fix crash when copying macros with instant preview on. + - Fix bad cursor font in some cases after changing layout (bug 4294). - Fix name and hint of figure captions in documents using the class aastex.