Author: vfr
Date: Mon Jan 3 15:12:53 2011
New Revision: 37072
URL: http://www.lyx.org/trac/changeset/37072
Log:
Fix bug #7050: Assert when using DecimalAlignment in tables.
The problem is/was that when copying an InsetTableCell?, the
macrocontext_position_ and the buffer_ were not copied. That's why in
insettabul...@splitcell@521 and in InsetTabular::TeXRow() and in
InsetTabular::metrics we manually copy this into the new object.
However, splitCell() returns the object by-value. So, when we call
InsetTableCell tail = splitCell(head, column_info[c].decimal_point, hassep);
the new object is copied into tail and we lose the buffer_ and
macro_contextposition. Later we will crash.
What does *nix in this case ? Apparently they don't make buffer and/or
macro_contextposition 0.
Modified:
lyx-devel/trunk/src/insets/InsetTabular.cpp
Modified: lyx-devel/trunk/src/insets/InsetTabular.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetTabular.cpp Mon Jan 3 13:50:47 2011
(r37071)
+++ lyx-devel/trunk/src/insets/InsetTabular.cpp Mon Jan 3 15:12:53 2011
(r37072)
@@ -518,9 +518,6 @@
InsetTableCell splitCell(InsetTableCell & head, docstring const align_d, bool
& hassep)
{
InsetTableCell tail = InsetTableCell(head);
- tail.getText(0)->setMacrocontextPosition(
- head.getText(0)->macrocontextPosition());
- tail.setBuffer(head.buffer());
DocIterator dit = doc_iterator_begin(&head.buffer(), &head);
for (; dit; dit.forwardChar())
@@ -2524,6 +2521,9 @@
head.setBuffer(buffer());
bool hassep = false;
InsetTableCell tail = splitCell(head,
column_info[c].decimal_point, hassep);
+ tail.getText(0)->setMacrocontextPosition(
+ head.getText(0)->macrocontextPosition());
+ tail.setBuffer(head.buffer());
head.latex(os, newrp);
os << '&';
ret += tail.latex(os, newrp);
@@ -3437,6 +3437,9 @@
bool hassep = false;
InsetTableCell tail =
splitCell(head,
tabular.column_info[c].decimal_point, hassep);
+ tail.getText(0)->setMacrocontextPosition(
+
head.getText(0)->macrocontextPosition());
+ tail.setBuffer(head.buffer());
Dimension dim1;
head.metrics(m, dim1);
decimal_hoffset = dim1.width();