From 3ac28c69e8cc163d1024f79e40032739059227e7 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 3 Jan 2011 14:12:53 +0000 Subject: [PATCH] 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 InsetTabular?@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. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37072 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetTabular.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index eff9063057..c7bdc768f9 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -518,9 +518,6 @@ string const featureAsString(Tabular::Feature action) 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 @@ int Tabular::TeXRow(odocstream & os, row_type row, 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 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const 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(); -- 2.39.2