]> git.lyx.org Git - features.git/commitdiff
Avoid recursive loop and let it crash "normally" (bug 3189).
authorAbdelrazak Younes <younes@lyx.org>
Wed, 31 Jan 2007 17:59:48 +0000 (17:59 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 31 Jan 2007 17:59:48 +0000 (17:59 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16982 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/MathParser.C

index 9bab600667831c08ce0ce4deb08b133be8e61abf..c18f9ad73dd39c5ca7111a64f3d748dfd3e50139 100644 (file)
@@ -284,8 +284,18 @@ private:
 
 ostream & operator<<(ostream & os, Token const & t)
 {
-       if (t.cs().size())
-               os << '\\' << t.cs();
+       if (t.cs().size()) {
+               docstring const & cs = t.cs();
+               // FIXME: For some strange reason, the stream operator instanciate
+               // a new Token before outputting the contents of t.cs().
+               // Because of this the line 
+               //     os << '\\' << cs;
+               // below becomes recursive.
+               // In order to avoid that we return early:
+               if (cs == "\\")
+                       return os;
+               os << '\\' << cs;
+       }
        else if (t.cat() == catLetter)
                os << t.character();
        else