Fix Fl_Table_Row inconsistencies, final part (#1187)

Adjust internal vector sizes before and after changing the rows() in
the base class to avoid inconsisten sizes.

Note that the crash reported by the OP of PR #1187 was caused by
more than one issue, not only the one fixed here. Thanks for the
original patch to the author, GitHub user 'basiliscos'.
This commit is contained in:
Albrecht Schlosser 2025-01-22 21:11:06 +01:00
parent 915ea80f45
commit 0c2aa40bbc

View File

@ -203,8 +203,8 @@ void Fl_Table_Row::select_all_rows(int flag) {
// Set number of rows
void Fl_Table_Row::rows(int val) {
Fl_Table::rows(val);
while ( val > (int)_rowselect.size() ) { _rowselect.push_back(0); } // enlarge
Fl_Table::rows(val);
while ( val < (int)_rowselect.size() ) { _rowselect.pop_back(); } // shrink
}