From kde-pim Sun Jul 26 18:14:24 2009 From: Eduardo Robles Elvira Date: Sun, 26 Jul 2009 18:14:24 +0000 To: kde-pim Subject: [Kde-pim] Segfault calling EntityTree::headerData() Message-Id: <9e2d3ad60907261114m5d8006c1x9060910a196f74fa () mail ! gmail ! com> X-MARC-Message: https://marc.info/?l=kde-pim&m=124863210511194 Hello PIM people and specially Stephen Kelly :P I've created my own model which inherits EntityTreeModel. In my code, I do something like this: QVariant KonqBookmarkModel::headerData( int section, Qt::Orientation orientation, int role ) const { if ( role == Qt::DisplayRole && orientation == Qt::Horizontal ) { switch( section ) { case Title: return i18nc( "@title:column, bookmark title", "Title" ); case Url: return i18nc( "@title:column, bookmark address", "Address" ); case UniqueUri: return i18nc( "@title:column, unique uri", "Uri" ); case Tags: return i18nc( "@title:column, tags", "Tags" ); case Description: return i18nc( "@title:column, description", "Description" ); case NumVisits: return i18nc( "@title:column, visits counter", "Visits Counter" ); case Created: return i18nc( "@title:column, created", "Created" ); case LastModified: return i18nc( "@title:column, last modified", "Last Modified" ); case LastVisited: return i18nc( "@title:column, last visited", "Last Visited" ); default: return QString(); } } return EntityTreeModel::headerData( section, orientation, role ); } My akonadi-based bookmarks organizer is crashing on the above call to EntityTreeModel::headerData(). Here we can see the code of that method: QVariant EntityTreeModel::headerData( int section, Qt::Orientation orientation, int role ) const { const int headerSet = (role / TerminalUserRole); role %= TerminalUserRole; return getHeaderData( section, orientation, role, headerSet ); } As I've tested with the debugger, it sefaults exactly when trying to execute the call return getHeaderData( section, orientation, role, headerSet ); which does not even happen. In the moment of crashing, the vars are in this state: headerSet = 0 section = 0 orientation = Qt::Horizontal role = 13 Note that in enum Qt::ItemDataRole role = 13 means Qt::SizeHintRole, so this seems related to sizehint?. The backtrace is: Application: bookmarks (bookmarks), signal: Segmentation fault [KCrash Handler] #6 0xb803dffe in typeinfo name for Akonadi::KonqBookmarkModel () from /home/edulix/proyectos/kde4/lib/libkonqbookmark.so.4 #7 0xb7b425e5 in Akonadi::EntityTreeModel::headerData (this=0x951b0b0, section=0, orientation=Qt::Horizontal, role=13) at /home/edulix/proyectos/kde4/kdesvn/kdepimlibs/akonadi/entitytreemodel.cpp:595 #8 0xb802aa98 in Akonadi::KonqBookmarkModel::headerData (this=0x951b0b0, section=0, orientation=Qt::Horizontal, role=13) at /home/edulix/proyectos/kde4/kdesvn/gsoc/konqbookmark/konqbookmarkmodel.cpp:112 #9 0xb78c3edc in QSortFilterProxyModel::headerData (this=0x952b270, section=0, orientation=Qt::Horizontal, role=13) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qsortfilterproxymodel.cpp:1623 #10 0xb784c597 in QHeaderView::sectionSizeFromContents (this=0x93d5c68, logicalIndex=0) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qheaderview.cpp:2519 #11 0xb784d3b6 in QHeaderView::sizeHint (this=0x93d5c68) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qheaderview.cpp:534 #12 0xb787b5ff in QTreeView::updateGeometries (this=0x93d7920) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qtreeview.cpp:2684 #13 0xb7876780 in QTreeView::columnCountChanged (this=0x93d7920, oldCount=0, newCount=9) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qtreeview.cpp:2523 #14 0xb7885a42 in QTreeView::qt_metacall (this=0x93d7920, _c=QMetaObject::InvokeMetaMethod, _id=14, _a=0xbfc66dd8) at .moc/release-shared/moc_qtreeview.cpp:143 #15 0xb7fee9f0 in Akonadi::EntityTreeView::qt_metacall (this=0x93d7920, _c=QMetaObject::InvokeMetaMethod, _id=83, _a=0xbfc66dd8) at /home/edulix/proyectos/kde4/kdesvn/build/kdepim/akonadi/akonadi_next/entitytreeview.moc:81 #16 0xb802356a in Akonadi::KonqBookmarkView::qt_metacall (this=0x93d7920, _c=QMetaObject::InvokeMetaMethod, _id=83, _a=0xbfc66dd8) at /home/edulix/proyectos/kde4/kdesvn/build/gsoc/konqbookmark/moc_konqbookmarkview.cpp:67 #17 0xb6ee0c98 in QMetaObject::activate (sender=0x93d5c68, from_signal_index=75, to_signal_index=75, argv=0xbfc66dd8) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/corelib/kernel/qobject.cpp:3108 #18 0xb6ee1262 in QMetaObject::activate (sender=0x93d5c68, m=0xb7a2fbd8, local_signal_index=6, argv=0xbfc66dd8) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/corelib/kernel/qobject.cpp:3185 #19 0xb784abe9 in QHeaderView::sectionCountChanged (this=0x93d5c68, _t1=0, _t2=9) at .moc/release-shared/moc_qheaderview.cpp:251 ....... Any ideas? Something is really wrong, because I've tried to change the line return EntityTreeModel::headerData( section, orientation, role ); with return QVariant(); to see if that was the only problem but it then gives me a different crash report: Application: bookmarks (bookmarks), signal: Segmentation fault [KCrash Handler] #6 0x080656ca in vtable for __cxxabiv1::__si_class_type_info () #7 0xb7b1cb7b in Akonadi::EntityTreeModel::data (this=0x92de5b0, index=@0xbf93d9e0, role=13) at /home/edulix/proyectos/kde4/kdesvn/kdepimlibs/akonadi/entitytreemodel.cpp:288 #8 0xb789622c in QSortFilterProxyModel::data (this=0x92e9a10, index=@0xbf93db88, role=13) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qsortfilterproxymodel.cpp:1589 #9 0xb78631a0 in QItemDelegate::sizeHint (this=0x93233d0, option=@0xbf93db08, index=@0xbf93db88) at ../../include/QtCore/../../../../qt-copy/src/corelib/kernel/qabstractitemmodel.h:378 #10 0xb7851c6e in QTreeView::indexRowSizeHint (this=0x915a688, index=@0x94ef900) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qtreeview.cpp:2806 #11 0xb78572ad in QTreeView::rowsInserted (this=0x915a688, parent=@0xbf93de74, start=0, end=0) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qtreeview.cpp:2436 #12 0xb781bf26 in QAbstractItemView::qt_metacall (this=0x915a688, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0xbf93de34) at .moc/release-shared/moc_qabstractitemview.cpp:227 #13 0xb785c7ba in QTreeView::qt_metacall (this=0x915a688, _c=QMetaObject::InvokeMetaMethod, _id=48, _a=0xbf93de34) at .moc/release-shared/moc_qtreeview.cpp:124 #14 0xb7fc59f0 in Akonadi::EntityTreeView::qt_metacall (this=0x915a688, _c=QMetaObject::InvokeMetaMethod, _id=48, _a=0xbf93de34) at /home/edulix/proyectos/kde4/kdesvn/build/kdepim/akonadi/akonadi_next/entitytreeview.moc:81 #15 0xb7ffa4fa in Akonadi::KonqBookmarkView::qt_metacall (this=0x915a688, _c=QMetaObject::InvokeMetaMethod, _id=48, _a=0xbf93de34) at /home/edulix/proyectos/kde4/kdesvn/build/gsoc/konqbookmark/moc_konqbookmarkview.cpp:67 #16 0xb6eb7c98 in QMetaObject::activate (sender=0x92e9a10, from_signal_index=9, to_signal_index=9, argv=0xbf93de34) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/corelib/kernel/qobject.cpp:3108 #17 0xb6eb8262 in QMetaObject::activate (sender=0x92e9a10, m=0xb6f504f8, local_signal_index=5, argv=0xbf93de34) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/corelib/kernel/qobject.cpp:3185 #18 0xb6eeec8f in QAbstractItemModel::rowsInserted (this=0x92e9a10, _t1=@0xbf93de74, _t2=0, _t3=0) at .moc/release-shared/moc_qabstractitemmodel.cpp:159 #19 0xb6ea01c3 in QAbstractItemModel::endInsertRows (this=0x92e9a10) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/corelib/kernel/qabstractitemmodel.cpp:2081 #20 0xb78985bb in QSortFilterProxyModelPrivate::insert_source_items (this=0x92e89c0, source_to_proxy=@0x92e59f8, proxy_to_source=@0x92e59f0, source_items=@0xbf93dfa4, source_parent=@0xbf93e114, orient=Qt::Vertical, emit_signal=true) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qsortfilterproxymodel.cpp:617 #21 0xb789c922 in QSortFilterProxyModelPrivate::source_items_inserted (this=0x92e89c0, source_parent=@0xbf93e114, start=1, end=0, orient=Qt::Vertical) at /home2/edulix/proyectos/kde4/kdesvn/qt-copy/src/gui/itemviews/qsortfilterproxymodel.cpp:713 Which also seems to be related to sizes - I start seeing a pattern but I don't now yet how to fix it. Maybe it's not really related to sizes but when calling to sizeHint is where the problem arises, I don't know. Any ideas? Regards, Eduardo Robles Elvira. _______________________________________________ KDE PIM mailing list kde-pim@kde.org https://mail.kde.org/mailman/listinfo/kde-pim KDE PIM home page at http://pim.kde.org/