On 10/12/12 21:11, Tommaso Cucinotta wrote:
> On 10/12/12 15:16, Kornel Benko wrote:
>> triggers a crash.
> 
> Confirmed. Let me have a look.

The problem is that it crashes here:

        ColorCode const bg = buffer_.isExporting()
                       ? Color_white : PreviewLoader::backgroundColor();
        ColorCode const fg = buffer_.isExporting()
                       ? Color_black : PreviewLoader::foregroundColor();
        cs << pconverter_->command
           << " " << quoteName(latexfile.toFilesystemEncoding())
           << " --dpi " << int(font_scaling_factor)
           << " --fg " << theApp()->hexName(fg)
           << " --bg " << theApp()->hexName(bg);

but, when exporting from the command-line, theApp() doesn't exist. Any 
possible/meaningful replacement for these hexName() call ?

Otherwise, the quick'n'dirty attached patch fixes the crash (but I'd expect 
undesired exported fg/bg colours in some images).

        T.

commit cb58ad4
Author: Richard Heck <rgh...@lyx.org>
Date:   Mon Dec 10 11:09:50 2012 -0500

    Temporary fix: while exporting from the command-line, theApp() doesn't exist.

diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp
index 6185681..80225e0 100644
--- a/src/graphics/PreviewLoader.cpp
+++ b/src/graphics/PreviewLoader.cpp
@@ -584,19 +584,11 @@ void PreviewLoader::Impl::startLoading(bool wait)
 		buffer_.isExporting() ? 75.0 * buffer_.params().html_math_img_scale 
 			: 0.01 * lyxrc.dpi * lyxrc.zoom * lyxrc.preview_scale_factor;
 
-	// FIXME XHTML 
-	// The colors should be customizable.
-	ColorCode const bg = buffer_.isExporting() 
-	               ? Color_white : PreviewLoader::backgroundColor();
-	ColorCode const fg = buffer_.isExporting() 
-	               ? Color_black : PreviewLoader::foregroundColor();
 	// The conversion command.
 	ostringstream cs;
 	cs << pconverter_->command
 	   << " " << quoteName(latexfile.toFilesystemEncoding())
-	   << " --dpi " << int(font_scaling_factor)
-	   << " --fg " << theApp()->hexName(fg)
-	   << " --bg " << theApp()->hexName(bg);
+	   << " --dpi " << int(font_scaling_factor);
 	// FIXME what about LuaTeX?
 	if (buffer_.params().useNonTeXFonts)
 		cs << " --latex=xelatex";

Reply via email to