mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
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.
This commit is contained in:
parent
4d7453ac86
commit
30cf941cb3
@ -1439,7 +1439,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();
|
||||
|
Loading…
Reference in New Issue
Block a user