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),
|
connect(m_groupByCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
this, &MailListView::onGroupByChanged);
|
this, &MailListView::onGroupByChanged);
|
||||||
// Default to conversation grouping (Wino-style), index 2 = GroupByThread
|
|
||||||
m_groupByCombo->setCurrentIndex(2);
|
|
||||||
filterLayout->addWidget(m_groupByCombo);
|
filterLayout->addWidget(m_groupByCombo);
|
||||||
|
|
||||||
layout->addWidget(filterBar);
|
layout->addWidget(filterBar);
|
||||||
@@ -248,6 +246,10 @@ void MailListView::setupUI()
|
|||||||
m_treeModel = new EmailTreeModel(this);
|
m_treeModel = new EmailTreeModel(this);
|
||||||
// Wino-style default: group inbox by conversation (thread)
|
// Wino-style default: group inbox by conversation (thread)
|
||||||
m_treeModel->setGroupMode(EmailTreeModel::GroupByThread);
|
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 = new QSortFilterProxyModel(this);
|
||||||
m_proxyModel->setSourceModel(m_treeModel);
|
m_proxyModel->setSourceModel(m_treeModel);
|
||||||
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ private:
|
|||||||
QTreeView *m_treeView;
|
QTreeView *m_treeView;
|
||||||
QListView *m_listView;
|
QListView *m_listView;
|
||||||
QStackedWidget *m_viewStack;
|
QStackedWidget *m_viewStack;
|
||||||
EmailTreeModel *m_treeModel;
|
EmailTreeModel *m_treeModel = nullptr;
|
||||||
QSortFilterProxyModel *m_proxyModel;
|
QSortFilterProxyModel *m_proxyModel = nullptr;
|
||||||
QSortFilterProxyModel *m_listProxyModel; // Separate proxy for list view using EmailListModel
|
QSortFilterProxyModel *m_listProxyModel; // Separate proxy for list view using EmailListModel
|
||||||
EmailListModel *m_sourceModel = nullptr;
|
EmailListModel *m_sourceModel = nullptr;
|
||||||
QPushButton *m_composeButton;
|
QPushButton *m_composeButton;
|
||||||
|
|||||||
Reference in New Issue
Block a user