mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 02:49:46 +00:00
Work around crash on command line export
This was a regression of 0c093a6264
. The crash was found by the tex2lyx
test case test-insets.tex: Running lyx -f main -e pdflatex test-insets.lyx.lyx
did crash. This is not a real fix, but will do for now since previews are not
needed in command line mode (I wonder why they are generated at all?) In the
long term, we need theApp() to return a console application in commandline
mode to eliminate the existing sifferences between export from GUI and
commandline.
This commit is contained in:
parent
b84a5ac0d5
commit
211ac35314
@ -411,8 +411,13 @@ PreviewLoader::Impl::Impl(PreviewLoader & p, Buffer const & b)
|
||||
: parent_(p), buffer_(b), finished_generating_(true)
|
||||
{
|
||||
font_scaling_factor_ = int(buffer_.fontScalingFactor());
|
||||
if (theApp()) {
|
||||
fg_color_ = strtol(theApp()->hexName(foregroundColor()).c_str(), 0, 16);
|
||||
bg_color_ = strtol(theApp()->hexName(backgroundColor()).c_str(), 0, 16);
|
||||
} else {
|
||||
fg_color_ = 0x0;
|
||||
bg_color_ = 0xffffff;
|
||||
}
|
||||
if (!pconverter_)
|
||||
pconverter_ = setConverter("lyxpreview");
|
||||
|
||||
@ -439,8 +444,12 @@ PreviewImage const *
|
||||
PreviewLoader::Impl::preview(string const & latex_snippet) const
|
||||
{
|
||||
int fs = int(buffer_.fontScalingFactor());
|
||||
int fg = strtol(theApp()->hexName(foregroundColor()).c_str(), 0, 16);
|
||||
int bg = strtol(theApp()->hexName(backgroundColor()).c_str(), 0, 16);
|
||||
int fg = 0x0;
|
||||
int bg = 0xffffff;
|
||||
if (theApp()) {
|
||||
fg = strtol(theApp()->hexName(foregroundColor()).c_str(), 0, 16);
|
||||
bg = strtol(theApp()->hexName(backgroundColor()).c_str(), 0, 16);
|
||||
}
|
||||
if (font_scaling_factor_ != fs || fg_color_ != fg || bg_color_ != bg) {
|
||||
// Schedule refresh of all previews on zoom or color changes.
|
||||
// The previews are regenerated only after the zoom factor
|
||||
|
Loading…
Reference in New Issue
Block a user