commit b01f7a6bdd860753e0bd27818ff2c3cc2f2ce783
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Wed Dec 23 11:05:28 2015 +0100

    Avoid swapping a cell with itself
    
    Gcc STL debugging feature asserts when swapping an object with itself. This 
happens in some cases with math grids that have only one column.
    
    A quick review of other uses of swap() in the code base did not reveal any 
other dubious case.
    
    Fixes bug #9902.

diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index 07f0b2c..a67569c 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -1194,7 +1194,8 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest 
& cmd)
 
                // split cell
                splitCell(cur);
-               swap(cell(cur.idx()), cell(cur.idx() + ncols() - 1));
+               if (ncols() > 1)
+                       swap(cell(cur.idx()), cell(cur.idx() + ncols() - 1));
                if (cur.idx() > 0)
                        --cur.idx();
                cur.pos() = cur.lastpos();
diff --git a/status.21x b/status.21x
index afb9822..19c9f93 100644
--- a/status.21x
+++ b/status.21x
@@ -83,6 +83,8 @@ What's new
 
 - Fix crash when unfolding/copying macros containing other macros (bug 9490).
 
+- Fix crash when inserting a line in multline math environment (bug 9902). 
+
 - Fix automatic insertion of longtable captions (bug 9692).
 
 - Fix setting of nested minipage via the dialog (bug 8716).

Reply via email to