Skip to content
Snippets Groups Projects
Commit 9637d4d0 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

fixed crash on lambda changed on tg server

parent b4423754
No related branches found
No related tags found
No related merge requests found
......@@ -128,9 +128,11 @@ void I0mapmon_topo::m_onWlenSelectionChanged(QString wlen, bool on) {
void I0mapmon_topo::m_onLambdaChanged(const QVector<double> &la) {
printf("\e[1;32 I0mapmon_topo::m_onLambdaChanged >>>>>> IN <<<< \e[0m\n");
QVector<double> current_l;
QMap<double, bool> prev_checked;
for(int i = 0; m_cb_model != nullptr && i < m_cb_model->rowCount(); i++) {
printf("\e[1;35mI0mapmon_topo::m_onLambdaChanged: row count %d item %d -> %s\e[0m\n", m_cb_model->rowCount(), i, qstoc(m_cb_model->item(i)->text()));
current_l << m_cb_model->item(i)->text().toDouble();
prev_checked[current_l.last()] = m_cb_model->item(i)->data(Qt::CheckStateRole).toBool();
}
qDebug() << __PRETTY_FUNCTION__ << la << "current_l" << current_l;
if(current_l != la) {
......@@ -138,11 +140,11 @@ void I0mapmon_topo::m_onLambdaChanged(const QVector<double> &la) {
QVector<int> wlens_idx;
CheckableComboBoxModel *new_m = new CheckableComboBoxModel(this);
for(int i = 0; i < la.size(); i++) {
bool checked = m_cb_model == nullptr || m_cb_model->findItem(la.at(i)) == nullptr || m_cb_model->findItem(la.at(i))->data(Qt::CheckStateRole).toBool();
bool checked = m_cb_model == nullptr || m_cb_model->findItem(la.at(i)) == nullptr || m_cb_model->findItem(la.at(i))->data(Qt::CheckStateRole).toBool() || prev_checked[la[i]];
printf("I0mapmon_topo::m_onLambdaChanged \e[1;33m %f --> %d\e[0m m_cb_model %p \n", la[i], i, m_cb_model);
if(m_cb_model) {
printf(" cb_model not null: found item %p for lam %f item count %d\n", m_cb_model->findItem(la.at(i)), la.at(i), m_cb_model->rowCount());
if(m_cb_model->findItem(la.at(i)), la.at(i))
if(m_cb_model->findItem(la.at(i)))
printf(" the item is checked? item : %s checked %d\n", qstoc(m_cb_model->findItem(la.at(i))->text()), m_cb_model->findItem(la.at(i))->data(Qt::CheckStateRole).toBool());
}
printf("checked is \e[1;32m%d\e[0m\n", checked);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment