Bug 328578

Summary: crash when opening settings
Product: [Applications] digikam Reporter: nucleo <nucleo>
Component: Setup-CollectionsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: amantia, caulier.gilles, cfeck, demm, kristian.hermann.karl, rdieter, tpr
Priority: NOR    
Version: 3.5.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 4.0.0
Sentry Crash Report:

Description nucleo 2013-12-09 15:14:34 UTC
digiKam 4.0.0-beta1 crashes when opening settings.

Reproducible: Always

Actual Results:  
Program received signal SIGSEGV, Segmentation fault.
QFont::QFont (this=0xbf800044) at text/qfont.cpp:791
791	    : d(QApplication::font().d.data()), resolve_mask(0)
(gdb) bt
#0  QFont::QFont (this=0xbf800044) at text/qfont.cpp:791
#1  0xb4bedffa in QStyleOption::QStyleOption (this=this@entry=0xbf80016c, version=version@entry=4, type=type@entry=12)
    at styles/qstyleoption.cpp:163
#2  0xb4bf055e in QStyleOptionViewItem::QStyleOptionViewItem (this=this@entry=0xbf80016c, version=version@entry=4)
    at styles/qstyleoption.cpp:4440
#3  0xb4bf05e5 in QStyleOptionViewItemV2::QStyleOptionViewItemV2 (this=this@entry=0xbf80016c, version=version@entry=4)
    at styles/qstyleoption.cpp:874
#4  0xb4bf0686 in QStyleOptionViewItemV3::QStyleOptionViewItemV3 (this=this@entry=0xbf80016c, version=version@entry=4)
    at styles/qstyleoption.cpp:992
#5  0xb4bf06e7 in QStyleOptionViewItemV4::QStyleOptionViewItemV4 (this=0xbf80016c) at styles/qstyleoption.cpp:1103
#6  0xb542721e in optionView (this=0xb5dfce8, index=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:166
#7  KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:187
#8  0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#9  0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#10 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#11 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#12 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#13 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#14 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#15 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#16 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#17 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#18 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#19 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#20 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#21 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#22 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
---Type <return> to continue, or q <return> to quit---
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#23 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#24 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#25 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#26 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#27 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#28 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#29 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#30 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#31 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#32 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#33 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#34 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#35 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#36 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#37 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#38 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#39 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#40 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#41 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#42 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#43 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
---Type <return> to continue, or q <return> to quit---
#44 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#45 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#46 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#47 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#48 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#49 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#50 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#51 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#52 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#53 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#54 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#55 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#56 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#57 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#58 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#59 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#60 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#61 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#62 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#63 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#64 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
    at /usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:194
#65 0xb54273f0 in KWidgetItemDelegatePrivate::initializeModel (this=this@entry=0xb5dfce8, parent=...)
---Type <return> to continue, or q <return> to quit---q
 at /usr/src/debug/kdeliQuit
(gdb) q
Comment 1 caulier.gilles 2013-12-09 17:41:21 UTC
Sound like a problem with widget style. It crash in Qt (QFont class)...

It's not a digiKam problem. Perhaps a binary compatibility issue on your computer due to recent update.

Check your system...
Comment 2 nucleo 2013-12-09 17:48:02 UTC
(In reply to comment #1)
> It's not a digiKam problem. Perhaps a binary compatibility issue on your
> computer due to recent update.
> 
> Check your system...

This is impossible, all components have exact version dependencies on qt and kde libs. All libs used at build time are actually installed.
Comment 3 nucleo 2013-12-09 18:02:44 UTC
[17:11:14] <@Kevin_Kofler> nucleo: Infinite recursion… I think the model for that tree view is wrong.
[17:11:43] <@Kevin_Kofler> nucleo: I don't know where it comes from, if it's a stock model (like KDirItemModel or how it's called) or something from Digikam.
Comment 4 caulier.gilles 2013-12-09 18:20:56 UTC
yes, but here it do not crash. Some it's not a the real problem.

Check your Qt/KDE widget style...

Gilles Caulier
Comment 5 nucleo 2013-12-09 18:40:35 UTC
Maybe this problem specific to KDE 4.11.97?
I downgraded digiKam to 3.5.0 that also built against 4.11.97 and it also crashes.
Comment 6 caulier.gilles 2013-12-09 18:44:03 UTC
Yes, probably KDELibs bugs :

/usr/src/debug/kdelibs-4.11.97/kdeui/itemviews/kwidgetitemdelegate.cpp:166

Gilles Caulier
Comment 7 nucleo 2013-12-09 18:48:36 UTC
Then reassign bug to kdelibs?
Comment 8 Rex Dieter 2013-12-09 18:57:34 UTC
Re-assigned to kdelibs
Comment 9 Teemu Rytilahti 2013-12-11 00:14:38 UTC
The problem is caused by KWidgetItemDelegatePrivate::initializeModel(const QModelIndex &parent) calling itself again when the model returns ok for hasChildren.

if (index.isValid() && model->hasChildren(index)) {
            initializeModel(index);
        }

 In this case Digikam::SetupCollectionModel doesn't reimplement hasChildren, it will fall back to call this:
bool QAbstractItemModel::hasChildren(const QModelIndex &parent) const
{
    return (rowCount(parent) > 0) && (columnCount(parent) > 0);
}

And while parent.row() == 0 and it's checking against Item::parentId, which most likely is zero for your collection and then the same thing again.
Comment 10 Teemu Rytilahti 2013-12-11 00:29:14 UTC
I would say that this sounds more like a bug in digikam's model than in kdelibs. Or should initializeModel() check that the index is not completely the same before calling itself again?

Here's some printf-debugging output I was using:
digikam(6267)/digikam (core) Digikam::SetupCollectionModel::rowCount: QModelIndex(0,0,0xffffffffffffffff,Digikam::SetupCollectionModel(0x51f2540) )
digikam(6267)/digikam (core) Digikam::SetupCollectionModel::rowCount: internalId: -1
digikam(6267)/digikam (core) Digikam::SetupCollectionModel::rowCount: parentId: 0
digikam(6267)/digikam (core) Digikam::SetupCollectionModel::rowCount: QModelIndex(0,0,0xffffffffffffffff,Digikam::SetupCollectionModel(0x51f2540) )
digikam(6267)/digikam (core) Digikam::SetupCollectionModel::rowCount: internalId: -1
digikam(6267)/digikam (core) Digikam::SetupCollectionModel::rowCount: parentId: 0
digikam(6267)/digikam (core) Digikam::SetupCollectionModel::rowCount: QModelIndex(0,0,0xffffffffffffffff,Digikam::SetupCollectionModel(0x51f2540) )
digikam(6267)/digikam (core) Digikam::SetupCollectionModel::rowCount: internalId: -1
digikam(6267)/digikam (core) Digikam::SetupCollectionModel::rowCount: parentId: 0

parentId is just index.row() here. And in my collection (due to because it's a local one) the parentId inside of Item is set to 0.

    foreach(const Item& item, m_collections)
    {
        if (!item.deleted && item.parentId == parentId)
        {
            ++rowCount;
        }
    }
Comment 11 demm 2013-12-11 00:41:31 UTC
As requested on IRC by teprrr, I can confirm this bug with digikam 3.5.0 and kdelibs 4.11.97.
http://pastebin.kde.org/pkrglow9p
This segfault/crash does NOT happen on a system with the same distro, same Qt4, gcc, and digikam, only that system runs 4.11.4.  Digikam build for that version (just to be clear, digikam was rebuild for 4.11 beta1).
Comment 12 demm 2013-12-12 09:38:32 UTC
Issue is fixed here with kdelibs 4.12.0 build.
Comment 13 caulier.gilles 2013-12-12 09:56:38 UTC
Thanks for your feedback

Gilles Caulier
Comment 14 Teemu Rytilahti 2013-12-16 01:46:18 UTC
*** Bug 328835 has been marked as a duplicate of this bug. ***
Comment 15 nucleo 2013-12-18 19:58:57 UTC
I confirm that no crash with kdelibs-4.12.0.