Skip to content

Commit

Permalink
Split up a few single-liners to help debug crash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada committed Sep 13, 2020
1 parent 1baa2b2 commit 7eabba9
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/common/SignalVectorModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ class SignalVectorModel : public QAbstractTableModel,

Row &rowItem = this->rows_[row];

rowItem.items[column]->setData(value, role);
assert(this->columnCount_ == rowItem.items.size());

auto &cell = rowItem.items[column];

cell->setData(value, role);

if (rowItem.isCustomRow)
{
Expand Down Expand Up @@ -211,15 +215,23 @@ class SignalVectorModel : public QAbstractTableModel,
assert(row >= 0 && row < this->rows_.size() && column >= 0 &&
column < this->columnCount_);

return this->rows_[row].items[column]->flags();
const auto &rowItem = this->rows_[row];

assert(this->columnCount_ == rowItem.items.size());

return rowItem.items[column]->flags();
}

QStandardItem *getItem(int row, int column)
{
assert(row >= 0 && row < this->rows_.size() && column >= 0 &&
column < this->columnCount_);

return rows_[row].items[column];
const auto &rowItem = this->rows_[row];

assert(this->columnCount_ == rowItem.items.size());

return rowItem.items[column];
}

void deleteRow(int row)
Expand Down Expand Up @@ -395,7 +407,7 @@ class SignalVectorModel : public QAbstractTableModel,
SignalVector<TVectorItem> *vector_;
std::vector<Row> rows_;

int columnCount_;
const int columnCount_;

// returns the related index of the SignalVector
int getVectorIndexFromModelIndex(int index)
Expand Down

0 comments on commit 7eabba9

Please sign in to comment.