Alfredo Braunstein wrote:

> File->New
> Insert table, leave 5x5 default
> select it, cut it paste it. enter the table with the cursor -> crash

This seems to fix it. The problem was that a default Tabular::Tabular was
called and so InsetTableCell inside CellData inside a new Tabular still
pointed to the old Tabular.

No idea if this is the "correct" fix, all this backpointerage is fun! Seems
like the old times!

A/

Index: insets/InsetTabular.h
===================================================================
--- insets/InsetTabular.h	(revision 24894)
+++ insets/InsetTabular.h	(working copy)
@@ -236,6 +236,8 @@
 
 	/// constructor
 	Tabular(Buffer const &, col_type columns_arg, row_type rows_arg);
+	/// constructor
+	Tabular(Tabular const & other);
 
 	/// Returns true if there is a topline, returns false if not
 	bool topLine(idx_type cell) const;
Index: insets/InsetTabular.cpp
===================================================================
--- insets/InsetTabular.cpp	(revision 24894)
+++ insets/InsetTabular.cpp	(working copy)
@@ -573,6 +573,18 @@
 }
 
 
+Tabular::Tabular(Tabular const & other)
+{
+	*this = other;
+	size_t row_count = row_info.size();
+	size_t column_count = column_info.size();
+	for (row_type i = 0; i < row_count; ++i) {
+		for (col_type j = 0; j < column_count; ++j)
+			cell_info[i][j].inset->setTabular(this);
+	}
+}
+
+
 // activates all lines and sets all widths to 0
 void Tabular::init(Buffer const & buf, row_type rows_arg,
 		      col_type columns_arg)
@@ -591,13 +603,14 @@
 	size_t row_count = row_info.size();
 	size_t column_count = column_info.size();
 	// set silly default lines
-	for (row_type i = 0; i < row_count; ++i)
+	for (row_type i = 0; i < row_count; ++i) {
 		for (col_type j = 0; j < column_count; ++j) {
 			cell_info[i][j].top_line = true;
 			cell_info[i][j].left_line = true;
 			cell_info[i][j].bottom_line = i == 0 || i == row_count - 1;
 			cell_info[i][j].right_line = j == column_count - 1;
 		}
+	}
 }
 
 

Reply via email to