Bug 294097

Summary: Kgpg startup crash QSortFilterProxyModel and _q_sourceLayoutChanged.
Product: [Applications] kgpg Reporter: Alexander <alexander.nofamilyname>
Component: generalAssignee: Rolf Eike Beer <kde>
Status: RESOLVED FIXED    
Severity: crash CC: faure
Priority: NOR    
Version: 2.6.x   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In: 4.8.1
Sentry Crash Report:
Attachments: valgrind log

Description Alexander 2012-02-14 19:16:01 UTC
Application: kgpg (2.6.2)
KDE Platform Version: 4.7.4 (4.7.4)
Qt Version: 4.8.0
Operating System: Linux 3.2.0-1-amd64 x86_64
Distribution: Debian GNU/Linux unstable (sid)

-- Information about the crash:
Initially marked as https://bugs.kde.org/show_bug.cgi?id=254090 it seems that this crash is something different.

The crash can be reproduced every time.

-- Backtrace:
Application: KGpg (kgpg), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#6  QModelIndex (other=..., this=0x7fffd22ce020) at ../../include/QtCore/../../src/corelib/kernel/qabstractitemmodel.h:65
#7  QSortFilterProxyModel::parent (this=0xf66860, child=...) at itemviews/qsortfilterproxymodel.cpp:1659
#8  0x00007ff82bf9deab in parent (this=0xf73cb8) at ../../include/QtCore/../../src/corelib/kernel/qabstractitemmodel.h:393
#9  QTreeView::indexRowSizeHint (this=0xf65990, index=...) at itemviews/qtreeview.cpp:2794
#10 0x00007ff82bfa1bd9 in itemHeight (item=1, this=0xf675f0) at itemviews/qtreeview.cpp:3283
#11 QTreeViewPrivate::itemHeight (this=0xf675f0, item=1) at itemviews/qtreeview.cpp:3272
#12 0x00007ff82bfa1e73 in QTreeViewPrivate::updateScrollBars (this=0xf675f0) at itemviews/qtreeview.cpp:3504
#13 0x00007ff82bfa222f in QTreeView::updateGeometries (this=0xf65990) at itemviews/qtreeview.cpp:2721
#14 0x00007ff82bfac779 in QTreeView::timerEvent (this=0xf65990, event=0x7fffd22cef20) at itemviews/qtreeview.cpp:1184
#15 0x00007ff82adb4ae9 in QObject::event (this=0xf65990, e=<optimized out>) at kernel/qobject.cpp:1157
#16 0x00007ff82ba8d02b in QWidget::event (this=0xf65990, event=0x7fffd22cef20) at kernel/qwidget.cpp:8820
#17 0x00007ff82be4a436 in QFrame::event (this=0xf65990, e=0x7fffd22cef20) at widgets/qframe.cpp:557
#18 0x00007ff82becc5e3 in QAbstractScrollArea::event (this=0xf65990, e=0x7fffd22cef20) at widgets/qabstractscrollarea.cpp:996
#19 0x00007ff82bf6919b in QAbstractItemView::event (this=0xf65990, event=0x7fffd22cef20) at itemviews/qabstractitemview.cpp:1580
#20 0x00007ff82ba3cec4 in notify_helper (e=0x7fffd22cef20, receiver=0xf65990, this=0xc631b0) at kernel/qapplication.cpp:4555
#21 QApplicationPrivate::notify_helper (this=0xc631b0, receiver=0xf65990, e=0x7fffd22cef20) at kernel/qapplication.cpp:4527
#22 0x00007ff82ba41d43 in QApplication::notify (this=0xc4f380, receiver=0xf65990, e=0x7fffd22cef20) at kernel/qapplication.cpp:4416
#23 0x00007ff82c79aae6 in KApplication::notify (this=0xc4f380, receiver=0xf65990, event=0x7fffd22cef20) at ../../kdeui/kernel/kapplication.cpp:311
#24 0x00007ff82ad9b80c in QCoreApplication::notifyInternal (this=0xc4f380, receiver=0xf65990, event=0x7fffd22cef20) at kernel/qcoreapplication.cpp:876
#25 0x00007ff82adccb72 in sendEvent (event=0x7fffd22cef20, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#26 QTimerInfoList::activateTimers (this=0xc5edf0) at kernel/qeventdispatcher_unix.cpp:611
#27 0x00007ff82adca56d in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:186
#28 timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:180
#29 0x00007ff8270d80cf in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007ff8270d88c8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007ff8270d8a99 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007ff82adcad8f in QEventDispatcherGlib::processEvents (this=0xc29be0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#33 0x00007ff82bae14de in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#34 0x00007ff82ad9a5f2 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#35 0x00007ff82ad9a847 in QEventLoop::exec (this=0x7fffd22cf1b0, flags=...) at kernel/qeventloop.cpp:204
#36 0x00007ff82ad9f8d7 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1148
#37 0x00000000004231d9 in ?? ()
#38 0x00007ff82a5acead in __libc_start_main (main=<optimized out>, argc=<optimized out>, ubp_av=<optimized out>, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffd22cf628) at libc-start.c:228
#39 0x0000000000423265 in _start ()

Possible duplicates by query: bug 293695, bug 274572, bug 274398, bug 273393, bug 272884.

Reported using DrKonqi
Comment 1 Alexander 2012-02-14 19:20:33 UTC
Created attachment 68800 [details]
valgrind log
Comment 2 Rolf Eike Beer 2012-02-14 20:28:33 UTC
David, when I compare this backtrace to the very first one in bug 254090 I see it's exactly the same stack (just some moved line numbers).
Comment 3 David Faure 2012-02-15 17:49:45 UTC
Compare valgrind logs, not backtraces. The "usage that crashes" can be the same, but if the cause for the deletion of the data is different, then it's a different bug.

After more discussion on IRC, the issue is the fixPersistentIndexes() code in kgpg, so reassigning this back.
Comment 4 Rolf Eike Beer 2012-02-15 19:56:17 UTC
Git commit 751c40508de14dfc4f756ec6e5388d849d63004f by Rolf Eike Beer.
Committed on 15/02/2012 at 20:53.
Pushed by dakon into branch 'KDE/4.8'.

fix crashes on model changes

QAbstractItemModel::changePersistentIndex() is heavily underdocumented, so I
probably got it wrong. Use beginResetModel()/endResetModel() to guard "global"
changes in the model instead of layoutAboutToBeChanged()/layoutChanged(). This
should hopefully get rid of all the spurious crashes deep in the Qt model
implementation.
Related: bug 254090
FIXED-IN:4.8.1

M  +6    -28   model/kgpgitemmodel.cpp
M  +1    -2    model/kgpgitemmodel.h

http://commits.kde.org/kgpg/751c40508de14dfc4f756ec6e5388d849d63004f