]> git.lyx.org Git - features.git/commitdiff
Fix bug 5766: http://bugzilla.lyx.org/show_bug.cgi?id=5766.
authorVincent van Ravesteijn <vfr@lyx.org>
Mon, 9 Feb 2009 19:39:28 +0000 (19:39 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Mon, 9 Feb 2009 19:39:28 +0000 (19:39 +0000)
Crash when selecting a row and doing "Delete column" in a table with multicolumns.

The check "column + 1 < column_info.size()" checks whether there is at least one column after this one. However, this check is no longer valid if we remove the column from column_info first.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28419 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetTabular.cpp

index fdd4d3685b2f9c9dd9aed3040ef941fe1bf15935..313f86e0240218f3749d84ed4b0afac74e794575 100644 (file)
@@ -730,8 +730,7 @@ void Tabular::deleteColumn(col_type const column)
        if (column_info.size() == 1)
                return;
 
-       column_info.erase(column_info.begin() + column);
-       size_t row_count = row_info.size();
+       size_t const row_count = row_info.size();
        for (row_type i = 0; i < row_count; ++i) {
                // Care about multicolumn cells
                if (column + 1 < column_info.size() &&
@@ -741,6 +740,7 @@ void Tabular::deleteColumn(col_type const column)
                }
                cell_info[i].erase(cell_info[i].begin() + column);
        }
+       column_info.erase(column_info.begin() + column);
        updateIndexes();
 }