[EMAIL PROTECTED] wrote:
Author: forenr
Date: Wed Sep  3 10:17:00 2008
New Revision: 26290

URL: http://www.lyx.org/trac/changeset/26290
Log:
We may have buffers with different encodings, that, in turn, may also
be different from the language default ones.

Modified:
     lyx-devel/trunk/src/mathed/InsetMathHull.cpp

Modified: lyx-devel/trunk/src/mathed/InsetMathHull.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/mathed/InsetMathHull.cpp?rev=26290
==============================================================================
--- lyx-devel/trunk/src/mathed/InsetMathHull.cpp (original)
+++ lyx-devel/trunk/src/mathed/InsetMathHull.cpp Wed Sep  3 10:17:00 2008
@@ -450,7 +450,9 @@
        // in text mode (such as $\text{$\phi$}$) gets processed twice. The
        // first time as a whole, and the second time only the inner math.
        // In this last case inset.buffer() would be invalid.
-       static Encoding const * encoding = 
inset.buffer().language()->encoding();
+       static Encoding const * encoding = 0;

This use of 'static' looks fragile....

+       if (inset.isBufferValid())
+               encoding =&(inset.buffer().params().encoding());
        WriteStream wi(ls, false, true, false, encoding);

So encoding will keep the previous value if isBufferValid() return false. Are we sure that isBufferValid() will always return true the first time latexString() is called?

        inset.write(wi);
        return ls.str();




Reply via email to