From e180c4409043389c195bd4fa58307cc79d4c4e40 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Kundr=C3=A1t?= Date: Wed, 3 Jan 2018 17:39:47 +0100 Subject: [PATCH] Fix assert in unread count check during startup The "simple" QaimDfsIterator constructor which only takes a QModelIndex and not a pair of (QMI, QAIM) asserts when fed with an invalid iterator. This can happen in case the mailbox list is not available for some reason: ASSERT: "m_model" in file /home/jkt/work/prog/trojita/src/UiUtils/QaimDfsIterator.cpp, line 32 [...] #5 0x000000000066dc15 in UiUtils::QaimDfsIterator::QaimDfsIterator(QModelIndex const&) () #6 0x0000000000476483 in Gui::MainWindow::handleTrayIconChange() () #7 0x0000000000475dda in Gui::MainWindow::createSysTray() () #8 0x0000000000469077 in Gui::MainWindow::slotToggleSysTray() () #9 0x0000000000458fb5 in Gui::MainWindow::MainWindow(QSettings*) () #10 0x0000000000454bab in main () Change-Id: Ie9d71b06c86f9f06ea103fee94b414397e379f4b --- src/Gui/Window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp index f1674134..180b0bdc 100644 --- a/src/Gui/Window.cpp +++ b/src/Gui/Window.cpp @@ -1037,7 +1037,7 @@ void MainWindow::handleTrayIconChange() auto watchingMode = settings()->value(Common::SettingsNames::watchedFoldersKey).toString(); if (watchingMode == Common::SettingsNames::watchAll || watchingMode == Common::SettingsNames::watchSubscribed) { bool subscribedOnly = watchingMode == Common::SettingsNames::watchSubscribed; - unreadCount = std::accumulate(UiUtils::QaimDfsIterator(m_imapAccess->mailboxModel()->index(0, 0)), + unreadCount = std::accumulate(UiUtils::QaimDfsIterator(m_imapAccess->mailboxModel()->index(0, 0), m_imapAccess->mailboxModel()), UiUtils::QaimDfsIterator(), 0, [subscribedOnly](const int acc, const QModelIndex &idx) { if (subscribedOnly && !idx.data(Imap::Mailbox::RoleMailboxIsSubscribed).toBool()) -- 2.11.4.GIT