fix: SIGSEGV at startup - uninitialized m_treeModel pointer
m_treeModel/m_proxyModel were declared without '= nullptr', so the GroupByThread default applied during setupUI read garbage memory in debug builds (QtCreator/MinGW) -> condition '!m_treeModel' was false against junk and called setGroupMode on an invalid pointer -> SIGSEGV. - Initialize both pointers to nullptr in header - Apply combo default to index 2 only after m_treeModel is created (blockSignals) - Remove the premature setCurrentIndex(2) that fired before model creation
This commit is contained in:
@@ -149,8 +149,6 @@ void MailListView::setupUI()
|
||||
);
|
||||
connect(m_groupByCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &MailListView::onGroupByChanged);
|
||||
// Default to conversation grouping (Wino-style), index 2 = GroupByThread
|
||||
m_groupByCombo->setCurrentIndex(2);
|
||||
filterLayout->addWidget(m_groupByCombo);
|
||||
|
||||
layout->addWidget(filterBar);
|
||||
@@ -248,6 +246,10 @@ void MailListView::setupUI()
|
||||
m_treeModel = new EmailTreeModel(this);
|
||||
// Wino-style default: group inbox by conversation (thread)
|
||||
m_treeModel->setGroupMode(EmailTreeModel::GroupByThread);
|
||||
// Reflect the default in the group combo (model already set, block to avoid re-trigger)
|
||||
m_groupByCombo->blockSignals(true);
|
||||
m_groupByCombo->setCurrentIndex(2); // "Agrupar por conversación"
|
||||
m_groupByCombo->blockSignals(false);
|
||||
m_proxyModel = new QSortFilterProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_treeModel);
|
||||
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
||||
Reference in New Issue
Block a user