]> git.lyx.org Git - features.git/commitdiff
Fix Tabular::CellData::operator=()
authorGeorg Baum <baum@lyx.org>
Sat, 5 Jul 2014 09:44:13 +0000 (11:44 +0200)
committerGeorg Baum <baum@lyx.org>
Sat, 5 Jul 2014 09:44:13 +0000 (11:44 +0200)
Don't create an intermediate copy (found by Jean-Marc).
I doubt that this has anything to do with the mystery crash, but it works, and
following the standard patterns is better anyway.

src/insets/InsetTabular.cpp
src/insets/InsetTabular.h

index 1a84c8e2202e30538f0205ef014642100c19593a..433fe197e7593fc53d25082c82f34f7ef05f9f9e 100644 (file)
@@ -602,9 +602,29 @@ Tabular::CellData::CellData(CellData const & cs)
 {
 }
 
-Tabular::CellData & Tabular::CellData::operator=(CellData cs)
-{
-       swap(cs);
+Tabular::CellData & Tabular::CellData::operator=(CellData const & cs)
+{
+       if (&cs == this)
+               return *this;
+       cellno = cs.cellno;
+       width = cs.width;
+       multicolumn = cs.multicolumn;
+       multirow = cs.multirow;
+       mroffset = cs.mroffset;
+       alignment = cs.alignment;
+       valignment = cs.valignment;
+       decimal_hoffset = cs.decimal_hoffset;
+       decimal_width = cs.decimal_width;
+       voffset = cs.voffset;
+       top_line = cs.top_line;
+       bottom_line = cs.bottom_line;
+       left_line = cs.left_line;
+       right_line = cs.right_line;
+       usebox = cs.usebox;
+       rotate = cs.rotate;
+       align_special = cs.align_special;
+       p_width = cs.p_width;
+       inset.reset(static_cast<InsetTableCell *>(cs.inset->clone()));
        return *this;
 }
 
index be1a67f51fcfcad99ac95f7cfc8ff6b6589c1aa9..8941a831e41f4b6b6d82a5b67354c9a882d89116 100644 (file)
@@ -610,7 +610,7 @@ public:
                ///
                CellData(CellData const &);
                ///
-               CellData & operator=(CellData);
+               CellData & operator=(CellData const &);
                ///
                void swap(CellData & rhs);
                ///