Bug 261645 - Assert when changing the default theme [MessageList::Core::ModelPrivate::applyFilterToSubtree MessageList::Core::Model::setFilter MessageList::Core::Widget::statusSelected ]
Summary: Assert when changing the default theme [MessageList::Core::ModelPrivate::appl...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kdepim
Classification: Applications
Component: messagelist (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 192847 251876 253681 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-30 17:59 UTC by Christophe Marin
Modified: 2017-01-07 22:37 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Marin 2010-12-30 17:59:25 UTC
Using master,

Steps to reproduce:
* Select a different folder than your current one then a message,
* KMail Settings / Appearance
* Change the default theme / Apply

KMail won't crash if the status combo is not "Any Status"

Backtrace (truncated)

#10 0x00007fe77c3e3c35 in qFatal (msg=<value optimized out>) at global/qglobal.cpp:2511
#11 0x00007fe77c3e3c7a in qt_assert (assertion=0x5ba5 <Address 0x5ba5 out of bounds>, file=0x6 <Address 0x6 out of bounds>, line=-1) at global/qglobal.cpp:2027
#12 0x00007fe77683db64 in MessageList::Core::ModelPrivate::applyFilterToSubtree (this=0xb1bff0, item=0x3dfa0b0, parentIndex=...) at /kde/src/KDE/kdepim/messagelist/core/model.cpp:370
#13 0x00007fe77683daa3 in MessageList::Core::Model::setFilter (this=0xb08f60, filter=0x0) at /kde/src/KDE/kdepim/messagelist/core/model.cpp:360
#14 0x00007fe77687fdbc in MessageList::Core::Widget::statusSelected (this=0xb182b0, index=0) at /kde/src/KDE/kdepim/messagelist/core/widgetbase.cpp:1047
#15 0x00007fe776825010 in MessageList::Core::Widget::qt_metacall (this=0xb182b0, _c=QMetaObject::InvokeMetaMethod, _id=12, _a=0x7fff619a8e30) at /kde/build/KDE/kdepim/messagelist/moc_widgetbase.cpp:128
#16 0x00007fe7768249df in MessageList::Widget::qt_metacall (this=0xb182b0, _c=QMetaObject::InvokeMetaMethod, _id=39, _a=0x7fff619a8e30) at /kde/build/KDE/kdepim/messagelist/moc_widget.cpp:77
#17 0x00007fe77c4e9e3f in QMetaObject::activate (sender=0xad15a0, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x7fff619a8e30) at kernel/qobject.cpp:3272
#18 0x00007fe77bc6dbe1 in QComboBox::currentIndexChanged (this=<value optimized out>, _t1=0) at .moc/release-shared/moc_qcombobox.cpp:302
#19 0x00007fe77bc6dc4c in QComboBoxPrivate::_q_emitCurrentIndexChanged (this=<value optimized out>, index=...) at widgets/qcombobox.cpp:1264
#20 0x00007fe77bc6ddaf in QComboBoxPrivate::setCurrentIndex (this=0xad4dc0, mi=<value optimized out>) at widgets/qcombobox.cpp:2022
Comment 1 Christophe Marin 2011-04-07 12:12:03 UTC
Steps:

updated BT:

ASSERT: "mModelForItemFunctions" in file /kde/src/KDE/kdepim/messagelist/core/model.cpp, line 370

Program received signal SIGABRT, Aborted.
0x00007ffff52a9ab5 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff52a9ab5 in raise () from /lib64/libc.so.6
#1  0x00007ffff52aafb6 in abort () from /lib64/libc.so.6
#2  0x00007ffff6812924 in qt_message_output (msgType=<optimized out>, buf=<optimized out>) at global/qglobal.cpp:2282
#3  0x00007ffff6812aed in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg, msg=0x7ffff6964ba8 "ASSERT: \"%s\" in file %s, line %d", ap=0x7fffffff88e0) at global/qglobal.cpp:2328
#4  0x00007ffff6812c85 in qFatal (msg=<optimized out>) at global/qglobal.cpp:2511
#5  0x00007ffff6812cca in qt_assert (assertion=0x19c9 <Address 0x19c9 out of bounds>, file=0x6 <Address 0x6 out of bounds>, line=-1) at global/qglobal.cpp:2027
#6  0x00007ffff0c4ec3f in MessageList::Core::ModelPrivate::applyFilterToSubtree (this=0xb37ee0, item=0x11a85c0, parentIndex=...) at /kde/src/KDE/kdepim/messagelist/core/model.cpp:370
#7  0x00007ffff0c4eb83 in MessageList::Core::Model::setFilter (this=0xb2e340, filter=0x0) at /kde/src/KDE/kdepim/messagelist/core/model.cpp:360
#8  0x00007ffff0c8e8a6 in MessageList::Core::Widget::statusSelected (this=0xbd6280, index=0) at /kde/src/KDE/kdepim/messagelist/core/widgetbase.cpp:1047
#9  0x00007ffff0c36fab in MessageList::Core::Widget::qt_metacall (this=0xbd6280, _c=QMetaObject::InvokeMetaMethod, _id=12, _a=0x7fffffff8cb0) at /kde/build/KDE/kdepim/messagelist/moc_widgetbase.cpp:128
#10 0x00007ffff0c369c5 in MessageList::Widget::qt_metacall (this=0xbd6280, _c=QMetaObject::InvokeMetaMethod, _id=39, _a=0x7fffffff8cb0) at /kde/build/KDE/kdepim/messagelist/moc_widget.cpp:77
#11 0x00007ffff6919a5f in QMetaObject::activate (sender=0xbb02c0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fffffff8cb0) at kernel/qobject.cpp:3278
#12 0x00007ffff609ad51 in QComboBox::currentIndexChanged (this=<optimized out>, _t1=0) at .moc/release-shared/moc_qcombobox.cpp:302
#13 0x00007ffff609adbc in QComboBoxPrivate::_q_emitCurrentIndexChanged (this=<optimized out>, index=...) at widgets/qcombobox.cpp:1264
#14 0x00007ffff609af1f in QComboBoxPrivate::setCurrentIndex (this=0xb55fa0, mi=<optimized out>) at widgets/qcombobox.cpp:2022
#15 0x00007ffff609b04c in QComboBox::setCurrentIndex (this=<optimized out>, index=0) at widgets/qcombobox.cpp:2005
#16 0x00007ffff609f0b9 in QComboBox::qt_metacall (this=0xbb02c0, _c=QMetaObject::InvokeMetaMethod, _id=20, _a=0x7fffffff8f10) at .moc/release-shared/moc_qcombobox.cpp:186
#17 0x00007ffff7a59025 in KComboBox::qt_metacall (this=0xbb02c0, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0x7fffffff8f10) at /usr/src/debug/kdelibs-4.6.41_20110406/build/kdeui/kcombobox.moc:106
#18 0x00007ffff6919a5f in QMetaObject::activate (sender=0xb52780, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fffffff8f10) at kernel/qobject.cpp:3278
#19 0x00007ffff6961a94 in QAbstractItemModel::rowsInserted (this=<optimized out>, _t1=<optimized out>, _t2=0, _t3=0) at .moc/release-shared/moc_qabstractitemmodel.cpp:181
#20 0x00007ffff68ffbcc in QAbstractItemModel::endInsertRows (this=0xb52780) at kernel/qabstractitemmodel.cpp:2412
#21 0x00007ffff6267263 in QStandardItemModelPrivate::rowsInserted (this=0xb69030, parent=<optimized out>, row=<optimized out>, count=1) at itemviews/qstandarditemmodel.cpp:558
#22 0x00007ffff62682a4 in QStandardItemPrivate::insertRows (this=0xb4ed20, row=0, count=1, items=QList<QStandardItem *> = {...}) at itemviews/qstandarditemmodel.cpp:433
#23 0x00007ffff609e0ec in insertRow (aitem=0xb9f620, arow=0, this=0xb52780) at ../../src/gui/itemviews/qstandarditemmodel.h:438
#24 QComboBox::insertItem (this=<optimized out>, index=0, icon=..., text=<optimized out>, userData=...) at widgets/qcombobox.cpp:2115
#25 0x00007ffff0c8eee6 in QComboBox::addItem (this=0xbb02c0, aicon=..., atext="Any Status", auserData=...) at /usr/include/QtGui/qcombobox.h:327
#26 0x00007ffff0c89ed7 in MessageList::Core::Widget::populateStatusFilterCombo (this=0xbd6280) at /kde/src/KDE/kdepim/messagelist/core/widgetbase.cpp:233
#27 0x00007ffff0c36ecc in MessageList::Core::Widget::qt_metacall (this=0xbd6280, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7fffffff99a0) at /kde/build/KDE/kdepim/messagelist/moc_widgetbase.cpp:118
#28 0x00007ffff0c369c5 in MessageList::Widget::qt_metacall (this=0xbd6280, _c=QMetaObject::InvokeMetaMethod, _id=29, _a=0x7fffffff99a0) at /kde/build/KDE/kdepim/messagelist/moc_widget.cpp:77
#29 0x00007ffff6919a5f in QMetaObject::activate (sender=0xb68af0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3278
#30 0x00007ffff123b541 in MessageCore::TagListMonitor::tagsChanged (this=0xb68af0) at /kde/build/KDE/kdepim/messagecore/moc_taglistmonitor.cpp:83
#31 0x00007ffff1256486 in MessageCore::TagListMonitor::triggerUpdate () at /kde/src/KDE/kdepim/messagecore/taglistmonitor.cpp:47
#32 0x00007ffff6ce6568 in AppearancePageMessageTagTab::save (this=0x35676c0) at /kde/src/KDE/kdepim/kmail/configuredialog.cpp:2000
#33 0x00007ffff6d0931c in ConfigModuleWithTabs::save (this=0x34dc6b0) at /kde/src/KDE/kdepim/kmail/configuredialog_p.cpp:73
#34 0x00007fffefda98f7 in KCModuleProxy::save (this=<optimized out>) at /usr/src/debug/kdelibs-4.6.41_20110406/kutils/kcmoduleproxy.cpp:279
---Type <return> to continue, or q <return> to quit---
#35 0x00007fffefda6a28 in KCMultiDialogPrivate::apply (this=<optimized out>) at /usr/src/debug/kdelibs-4.6.41_20110406/kutils/kcmultidialog.cpp:300
#36 0x00007fffefda6b37 in KCMultiDialog::slotOkClicked (this=0xea9800) at /usr/src/debug/kdelibs-4.6.41_20110406/kutils/kcmultidialog.cpp:334
#37 0x00007ffff6cda2ba in ConfigureDialog::slotOk (this=0xea9800) at /kde/src/KDE/kdepim/kmail/configuredialog.cpp:254
#38 0x00007ffff6cf2a26 in ConfigureDialog::qt_metacall(enum QMetaObject::Call, int, void **) (this=0xea9800, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7fffffff9cf0) at /kde/build/KDE/kdepim/kmail/configuredialog.moc:79
#39 0x00007ffff6919a5f in QMetaObject::activate (sender=0xea9800, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3278
#40 0x00007ffff791e408 in KDialog::slotButtonClicked (this=0xea9800, button=4) at /usr/src/debug/kdelibs-4.6.41_20110406/kdeui/dialogs/kdialog.cpp:883
#41 0x00007ffff791e962 in KDialog::qt_metacall (this=0xea9800, _c=QMetaObject::InvokeMetaMethod, _id=33, _a=0x7fffffff9f20) at /usr/src/debug/kdelibs-4.6.41_20110406/build/kdeui/kdialog.moc:190
#42 0x00007ffff79f1a40 in KPageDialog::qt_metacall (this=0xea9800, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0x7fffffff9f20) at /usr/src/debug/kdelibs-4.6.41_20110406/build/kdeui/kpagedialog.moc:70
#43 0x00007fffefda7ac0 in KCMultiDialog::qt_metacall (this=0xea9800, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0x7fffffff9f20) at /usr/src/debug/kdelibs-4.6.41_20110406/build/kutils/kcmultidialog.moc:86
#44 0x00007ffff6cf29d9 in ConfigureDialog::qt_metacall(enum QMetaObject::Call, int, void **) (this=0xea9800, _c=QMetaObject::InvokeMetaMethod, _id=69, _a=0x7fffffff9f20) at /kde/build/KDE/kdepim/kmail/configuredialog.moc:72
#45 0x00007ffff6919a5f in QMetaObject::activate (sender=0xdaf2b0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fffffff9f20) at kernel/qobject.cpp:3278
#46 0x00007ffff691e43e in QSignalMapper::mapped (this=<optimized out>, _t1=4) at .moc/release-shared/moc_qsignalmapper.cpp:101
#47 0x00007ffff691e665 in QSignalMapper::map (this=0xdaf2b0, sender=0x3463340) at kernel/qsignalmapper.cpp:266
#48 0x00007ffff691ed20 in QSignalMapper::qt_metacall (this=0xdaf2b0, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x7fffffffa090) at .moc/release-shared/moc_qsignalmapper.cpp:87
#49 0x00007ffff6919a5f in QMetaObject::activate (sender=0x3463340, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fffffffa090) at kernel/qobject.cpp:3278
#50 0x00007ffff633a5a2 in QAbstractButton::clicked (this=<optimized out>, _t1=false) at .moc/release-shared/moc_qabstractbutton.cpp:206
#51 0x00007ffff6080f1b in QAbstractButtonPrivate::emitClicked (this=<optimized out>) at widgets/qabstractbutton.cpp:546
#52 0x00007ffff60824db in QAbstractButtonPrivate::click (this=0x3464b90) at widgets/qabstractbutton.cpp:539
#53 0x00007ffff608274c in QAbstractButton::mouseReleaseEvent (this=0x3463340, e=0x7fffffffaa10) at widgets/qabstractbutton.cpp:1121
#54 0x00007ffff5d1ec5c in QWidget::event (this=0x3463340, event=0x7fffffffaa10) at kernel/qwidget.cpp:8259
#55 0x00007ffff5ccd144 in QApplicationPrivate::notify_helper (this=0x65e2b0, receiver=0x3463340, e=0x7fffffffaa10) at kernel/qapplication.cpp:4462
#56 0x00007ffff5cd5f7c in QApplication::notify (this=<optimized out>, receiver=0x3463340, e=0x7fffffffaa10) at kernel/qapplication.cpp:4023
#57 0x00007ffff79c2a76 in KApplication::notify (this=0x7fffffffb650, receiver=0x3463340, event=0x7fffffffaa10) at /usr/src/debug/kdelibs-4.6.41_20110406/kdeui/kernel/kapplication.cpp:311
#58 0x00007ffff690547c in QCoreApplication::notifyInternal (this=0x7fffffffb650, receiver=0x3463340, event=0x7fffffffaa10) at kernel/qcoreapplication.cpp:731
#59 0x00007ffff5cce155 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../src/corelib/kernel/qcoreapplication.h:215
#60 QApplicationPrivate::sendMouseEvent (receiver=0x3463340, event=0x7fffffffaa10, alienWidget=0x3463340, nativeWidget=0xea9800, buttonDown=0x7ffff679f198, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:3122
#61 0x00007ffff5d4cb48 in QETWidget::translateMouseEvent (this=0xea9800, event=<optimized out>) at kernel/qapplication_x11.cpp:4461
#62 0x00007ffff5d4b209 in QApplication::x11ProcessEvent (this=0x7fffffffb650, event=0x7fffffffb380) at kernel/qapplication_x11.cpp:3587
#63 0x00007ffff5d73904 in QEventDispatcherX11::processEvents (this=0x6117c0, flags=...) at kernel/qeventdispatcher_x11.cpp:132
#64 0x00007ffff69048d2 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#65 0x00007ffff6904ae5 in QEventLoop::exec (this=0x7fffffffb510, flags=...) at kernel/qeventloop.cpp:201
#66 0x00007ffff6908f2b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1008
#67 0x0000000000403474 in main (argc=2, argv=0x7fffffffb7e8) at /kde/src/KDE/kdepim/kmail/main.cpp:145
Comment 2 Sergio Martins 2011-04-07 12:14:59 UTC
ASSERT: "mModelForItemFunctions" in file /kde/src/KDE/kdepim/messagelist/core/model.cpp, line 370

Will look at this after work.
Comment 3 Christophe Marin 2011-04-17 14:57:54 UTC
the initial assumption was incorrect it seems. I get the same crash if I try to change any setting on the "appearance" page (tested with custom colors, fonts or layout)
Comment 4 Sergio Martins 2011-04-17 23:17:38 UTC
This fixed it for me:

diff --git a/messagelist/core/model.cpp b/messagelist/core/model.cpp
index 446310c..10bfe22 100644
--- a/messagelist/core/model.cpp
+++ b/messagelist/core/model.cpp
@@ -353,6 +353,9 @@ void Model::setFilter( const Filter *filter )
     return;
 
   QModelIndex idx; // invalid
+  if ( !d->mViewItemJobs.isEmpty() ) {
+    return;
+  }
 
   QApplication::setOverrideCursor( Qt::WaitCursor );
Comment 5 Sergio Martins 2011-04-17 23:20:15 UTC
I won't commit the patch because i have no idea of side effects, and i don't understand the code. Will have to ask tmcguire or pragma to have a look.

The crash happens because Model::setFilter() is called while a job that requires disconnected UI is still running.

Here's the stacktrace that leads to the Model::setFilter() call:

AppearancePage::MessageTagTab::save()
    MessageCore::TagListMonitor::triggerUpdate();
        emit instance->tagsChanged();
            (...)
            void Widget::populateStatusFilterCombo()
                Widget::statusSelected( int index )
                    Model::setFilter( const Filter *filter )
Comment 6 Sergio Martins 2011-04-17 23:35:52 UTC
*** Bug 251876 has been marked as a duplicate of this bug. ***
Comment 7 Sergio Martins 2011-04-17 23:41:51 UTC
*** Bug 253681 has been marked as a duplicate of this bug. ***
Comment 8 Szymon Stefanek 2011-04-18 23:40:19 UTC
Unfortunately I no longer have the devel source tree set up so I can't test/fix it directly. However the problems is exactly the one described in comment #5 by Sergio. Filters and disconnected-UI jobs don't go together.

I agree that it's a bit messy. The key point for disconnected-UI was performance. I'm not sure if this is still really needed as the Qt model-view implementation has probably improved in the meantime. Some testing would be needed.

However.

Disconnecting the UI means "not telling the model-view framework that single items are being inserted" and later (when UI is reconnected) declaring layoutChanged() at once. Filters, however, use QTreeView::setRowHidden() so the view must be "aware" of the items being inside it.

Disconnected UI jobs are usually very short but they can still be interrupted: inside Model::viewItemJobStepInternal() there is a path that returns control to the event loop with mModelForItemFunctions left to 0. 

Two possible solutions:

- If a filter has to be applied when a disconnected UI job is running, reconnect the UI (and remove the disconnected-UI flag from the job). This means moving the UI reconnection code from Model::viewItemJobStepInternal() to its own function and calling it in two places.

- Reconnect the UI as soon as a job with disconnected UI is interrupted (or finishes, as it is now). This is simpler as it can be done entirely inside Model::viewItemJobStepInternal() but it possibly reduces the performance a bit (?).
Comment 9 Sergio Martins 2011-04-19 21:46:26 UTC
Git commit 2f2e06be9720286a3505573a639c1c68768f4c16 by Sergio Martins.
Committed on 19/04/2011 at 22:46.
Pushed by smartins into branch 'master'.

Don't signal that tags changed everytime you use the configure dialog.

Check if the user modified them first.

Saves some MessageList::Core::Model::setFilter() calls, and makes
bug 261645 reproducible in less use cases.

CCBUG:261645

M  +19   -0    kmail/configuredialog.cpp     
M  +3    -0    kmail/configuredialog_p.h     

http://commits.kde.org/kdepim/2f2e06be9720286a3505573a639c1c68768f4c16
Comment 10 Myriam Schweingruber 2012-07-09 10:49:47 UTC
*** Bug 192847 has been marked as a duplicate of this bug. ***
Comment 11 Denis Kurz 2016-09-24 21:00:22 UTC
This bug has only been reported for versions before 4.14, which have been unsupported for at least two years now. Can anyone tell if this bug still present?

If noone confirms this bug for a Framework-based version of kdepim (version 5.0 or later, as part of KDE Applications 15.08 or later), it gets closed in about three months.
Comment 12 Denis Kurz 2017-01-07 22:37:49 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.