On Mon, Sep 26, 2016 at 02:46:48PM -0400, Scott Kostyshak wrote:
> On Mon, Sep 26, 2016 at 09:48:52AM +0200, Jürgen Spitzmüller wrote:
> 
> > I get the error both with Preview and Export.
> 
> I tested again and in three tries (starting with a fresh LyX session)
> with only Preview, two times I got the error and one time I did not.
> I'm curious how others would approach debugging this issue. Am I right
> that two likely possibilities are an uninitialized member variable and a
> threading issue? Are there other likely candidates for this type of bug
> where the behavior seems somewhat random?

To reproduce, apply the attached patch to master and compile. Then:

1. Open lib/doc/sk/Intro.lyx
2. Preview as PDF (LuaTeX)

Sometimes the above will give an error, sometimes it won't. When it is
successful, the following output (added with the patch) is shown:

"mit_second is not empty!"

Within a given LyX session, the compile will always give an error or
always not give an error (even if you force a recompile by adding text,
so not using the cache).

So to test multiple times, remember to exit LyX and then reopen
sk/Intro.lyx.

Scott
From 14a8daf7eee4127b822fd4a7a481eaa0242aea3c Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Sat, 1 Oct 2016 01:13:17 -0400
Subject: [PATCH] Debug code for bug

---
 lib/doc/sk/Intro.lyx | 16 +++++++++-------
 src/BufferParams.cpp |  4 +++-
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/lib/doc/sk/Intro.lyx b/lib/doc/sk/Intro.lyx
index 58073ef..c7b5b5d 100644
--- a/lib/doc/sk/Intro.lyx
+++ b/lib/doc/sk/Intro.lyx
@@ -1,5 +1,5 @@
-#LyX 2.2 created this file. For more info see http://www.lyx.org/
-\lyxformat 508
+#LyX 2.3 created this file. For more info see http://www.lyx.org/
+\lyxformat 512
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -31,18 +31,19 @@
 \language_package default
 \inputencoding auto
 \fontencoding global
-\font_roman "palatino" "default"
-\font_sans "helvet" "default"
-\font_typewriter "courier" "default"
+\font_roman "palatino" "FreeSans"
+\font_sans "helvet" "FreeSans"
+\font_typewriter "courier" "FreeSans"
 \font_math "auto" "auto"
 \font_default_family default
-\use_non_tex_fonts false
+\use_non_tex_fonts true
 \font_sc false
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
+\use_microtype false
 \graphics default
-\default_output_format pdf2
+\default_output_format default
 \output_sync 0
 \bibtex_command default
 \index_command default
@@ -2094,6 +2095,7 @@ type "mailto:";
 
 , spolu s 
 \begin_inset Branch english
+inverted 0
 status collapsed
 
 \begin_layout Standard
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index eff684d..785532b 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -2187,8 +2187,10 @@ bool BufferParams::writeLaTeX(otexstream & os, 
LaTeXFeatures & features,
                for (std::map<std::string, std::string>::const_iterator mit = 
polylangs.begin();
                     mit != polylangs.end() ; ++mit) {
                        lyxpreamble += "\\setotherlanguage";
-                       if (!mit->second.empty())
+                       if (!mit->second.empty()) {
+                               lyxerr << "mit_second is not empty!" << 
std::endl;
                                lyxpreamble += "[" + from_ascii(mit->second) + 
"]";
+                       }
                        lyxpreamble += "{" + from_ascii(mit->first) + "}\n";
                }
        }
-- 
2.7.4

Attachment: signature.asc
Description: PGP signature

Reply via email to