From dabfb1e65907eba324acfc2c965d929b5de60918 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 30 Aug 2026 13:59:05 +0200 Subject: [PATCH] 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 --- src/ui/maillistview.cpp | 6 ++++-- src/ui/maillistview.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ui/maillistview.cpp b/src/ui/maillistview.cpp index 24691cf..6b95dd0 100644 --- a/src/ui/maillistview.cpp +++ b/src/ui/maillistview.cpp @@ -149,8 +149,6 @@ void MailListView::setupUI() ); connect(m_groupByCombo, QOverload::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); diff --git a/src/ui/maillistview.h b/src/ui/maillistview.h index 25794bb..4d8bb61 100644 --- a/src/ui/maillistview.h +++ b/src/ui/maillistview.h @@ -106,8 +106,8 @@ private: QTreeView *m_treeView; QListView *m_listView; QStackedWidget *m_viewStack; - EmailTreeModel *m_treeModel; - QSortFilterProxyModel *m_proxyModel; + EmailTreeModel *m_treeModel = nullptr; + QSortFilterProxyModel *m_proxyModel = nullptr; QSortFilterProxyModel *m_listProxyModel; // Separate proxy for list view using EmailListModel EmailListModel *m_sourceModel = nullptr; QPushButton *m_composeButton;