Bug 444408 - Crash when searching collection [CollectionTreeItem::row]
Summary: Crash when searching collection [CollectionTreeItem::row]
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 2.9.71
Platform: openSUSE Linux
: NOR crash
Target Milestone: kf5
Assignee: Amarok Developers
URL:
Keywords: drkonqi
: 465602 466401 481384 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-10-26 05:51 UTC by Ondrej Vana
Modified: 2024-03-23 19:03 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
New crash information added by DrKonqi (5.29 KB, text/plain)
2022-04-06 14:22 UTC, vortex
Details
New crash information added by DrKonqi (2.90 KB, text/plain)
2022-11-13 14:42 UTC, bjoern
Details
New crash information added by DrKonqi (6.29 KB, text/plain)
2023-01-02 21:27 UTC, Bernhard Kühnel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ondrej Vana 2021-10-26 05:51:39 UTC
Application: amarok (2.9.71)

Qt Version: 5.15.2
Frameworks Version: 5.87.0
Operating System: Linux 5.14.11-2-default x86_64
Windowing System: X11
Distribution: "openSUSE Tumbleweed"
DrKonqi: 5.23.0 [KCrashBackend]

-- Information about the crash:
- What I was doing when the application crashed:
Anytime a search is performed in collection, amarok (2.9.75git.20210830T182443~10309f00af-1.2) crashes. Searching in playlist works fine.

The crash can be reproduced every time.

-- Backtrace:
Application: Amarok (amarok), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>}
[KCrash Handler]
#6  0x00007f372ec8e7fe in CollectionTreeItem::row (this=0x31) at /usr/src/debug/amarok-2.9.75git.20210830T182443~10309f00af-1.2.x86_64/src/browsers/CollectionTreeItem.cpp:224
#7  0x00007f372ec9d180 in CollectionTreeItemModelBase::itemIndex (item=0x31, this=0x561f25577270) at /usr/src/debug/amarok-2.9.75git.20210830T182443~10309f00af-1.2.x86_64/src/browsers/CollectionTreeItemModelBase.cpp:581
#8  CollectionTreeItemModelBase::itemIndex (this=0x561f25577270, item=0x31) at /usr/src/debug/amarok-2.9.75git.20210830T182443~10309f00af-1.2.x86_64/src/browsers/CollectionTreeItemModelBase.cpp:576
#9  0x00007f372ec92bd0 in CollectionTreeItemModelBase::parent (index=..., this=<optimized out>) at /usr/src/debug/amarok-2.9.75git.20210830T182443~10309f00af-1.2.x86_64/src/browsers/CollectionTreeItemModelBase.cpp:446
#10 CollectionTreeItemModelBase::parent (this=<optimized out>, index=...) at /usr/src/debug/amarok-2.9.75git.20210830T182443~10309f00af-1.2.x86_64/src/browsers/CollectionTreeItemModelBase.cpp:438
#11 0x00007f372d773b51 in QModelIndex::parent (this=0x561f27d1d930) at ../../include/QtCore/../../src/corelib/itemmodels/qabstractitemmodel.h:443
#12 QSortFilterProxyModelPrivate::_q_sourceDataChanged (this=0x561f259cdd00, source_top_left=..., source_bottom_right=..., roles=...) at itemmodels/qsortfilterproxymodel.cpp:1433
#13 0x00007f372d7d5048 in doActivate<false> (sender=0x561f25577270, signal_index=3, argv=0x7ffe44f4d700) at kernel/qobject.cpp:3898
#14 0x00007f372d7ce4df in QMetaObject::activate (sender=sender@entry=0x561f25577270, m=m@entry=0x7f372da72fa0 <QAbstractItemModel::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffe44f4d700) at kernel/qobject.cpp:3946
#15 0x00007f372d738d85 in QAbstractItemModel::dataChanged (this=this@entry=0x561f25577270, _t1=..., _t2=..., _t3=...) at .moc/moc_qabstractitemmodel.cpp:557
#16 0x00007f372ec9e9f7 in CollectionTreeItemModelBase::tracksLoaded (this=0x561f25577270, album=..., index=..., tracks=...) at /usr/src/debug/amarok-2.9.75git.20210830T182443~10309f00af-1.2.x86_64/src/browsers/CollectionTreeItemModelBase.cpp:724
#17 0x00007f372d7cafbe in QObject::event (this=0x561f25577270, e=0x7f36d4109940) at kernel/qobject.cpp:1314
#18 0x00007f372e34da7f in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x561f25577270, e=0x7f36d4109940) at kernel/qapplication.cpp:3632
#19 0x00007f372d79e9ca in QCoreApplication::notifyInternal2 (receiver=0x561f25577270, event=0x7f36d4109940) at kernel/qcoreapplication.cpp:1064
#20 0x00007f372d7a1a17 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x561f247454b0) at kernel/qcoreapplication.cpp:1821
#21 0x00007f372d7f6823 in postEventSourceDispatch (s=s@entry=0x561f24879bd0) at kernel/qeventdispatcher_glib.cpp:277
#22 0x00007f372a600d5f in g_main_dispatch (context=0x7f3720005000) at ../glib/gmain.c:3381
#23 g_main_context_dispatch (context=0x7f3720005000) at ../glib/gmain.c:4099
#24 0x00007f372a6010e8 in g_main_context_iterate (context=context@entry=0x7f3720005000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4175
#25 0x00007f372a60119f in g_main_context_iteration (context=0x7f3720005000, may_block=1) at ../glib/gmain.c:4240
#26 0x00007f372d7f5ea4 in QEventDispatcherGlib::processEvents (this=0x561f2487ce70, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#27 0x00007f372d79d3cb in QEventLoop::exec (this=this@entry=0x7ffe44f4dbb0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#28 0x00007f372d7a56b0 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#29 0x00007f372dbef19c in QGuiApplication::exec () at kernel/qguiapplication.cpp:1867
#30 0x00007f372e34d9f5 in QApplication::exec () at kernel/qapplication.cpp:2824
#31 0x0000561f234b1f62 in main (argc=<optimized out>, argv=0x7ffe44f4dcf0) at /usr/src/debug/amarok-2.9.75git.20210830T182443~10309f00af-1.2.x86_64/src/main.cpp:395
[Inferior 1 (process 2413) detached]

The reporter indicates this bug may be a duplicate of or related to bug 440801.

Possible duplicates by query: bug 440801, bug 299043, bug 289291, bug 288325, bug 288039.

Reported using DrKonqi
Comment 1 vortex 2022-04-06 14:22:43 UTC
Created attachment 148001 [details]
New crash information added by DrKonqi

amarok (2.9.71) using Qt 5.15.2

- What I was doing when the application crashed:
Searched for music in my local collection

-- Backtrace (Reduced):
#6  0x00007f9fbb8b88ee in CollectionTreeItem::row() const (this=0x31) at /usr/src/debug/amarok-2.9.75git.20220224T114455~9300034c57-1.2.x86_64/src/browsers/CollectionTreeItem.cpp:224
#7  0x00007f9fbb8c72f0 in CollectionTreeItemModelBase::itemIndex(CollectionTreeItem*) const (item=0x31, this=0x5599274ab180) at /usr/src/debug/amarok-2.9.75git.20220224T114455~9300034c57-1.2.x86_64/src/browsers/CollectionTreeItemModelBase.cpp:582
#8  CollectionTreeItemModelBase::itemIndex(CollectionTreeItem*) const (this=0x5599274ab180, item=0x31) at /usr/src/debug/amarok-2.9.75git.20220224T114455~9300034c57-1.2.x86_64/src/browsers/CollectionTreeItemModelBase.cpp:577
#9  0x00007f9fbb8bcc00 in CollectionTreeItemModelBase::parent(QModelIndex const&) const (index=<optimized out>, this=<optimized out>) at /usr/src/debug/amarok-2.9.75git.20220224T114455~9300034c57-1.2.x86_64/src/browsers/CollectionTreeItemModelBase.cpp:447
#10 CollectionTreeItemModelBase::parent(QModelIndex const&) const (this=<optimized out>, index=<optimized out>) at /usr/src/debug/amarok-2.9.75git.20220224T114455~9300034c57-1.2.x86_64/src/browsers/CollectionTreeItemModelBase.cpp:439
Comment 2 bjoern 2022-11-13 14:42:23 UTC
Created attachment 153710 [details]
New crash information added by DrKonqi

amarok (2.9.71) using Qt 5.15.2

- What I was doing when the application crashed:
typing in the search application crashes

- Unusual behavior I noticed:
application is very slow during startup and while opening the tree

- Custom settings of the application:
I use a sql-Database on the main computer for the files that are stored on an NAS-Server for more than 45000 titles

-- Backtrace (Reduced):
#4  0x00007fd85d1ef340 in CollectionTreeItem::row() const () at /usr/lib64/libamaroklib.so.1
#5  0x00007fd85d1f6d70 in CollectionTreeItemModelBase::itemIndex(CollectionTreeItem*) const () at /usr/lib64/libamaroklib.so.1
#6  0x00007fd85d1f6df0 in CollectionTreeItemModelBase::parent(QModelIndex const&) const () at /usr/lib64/libamaroklib.so.1
[...]
#10 0x00007fd85ac8a7fc in QAbstractItemModel::dataChanged(QModelIndex const&, QModelIndex const&, QVector<int> const&) () at /usr/lib64/libQt5Core.so.5
#11 0x00007fd85d1fa8d5 in CollectionTreeItemModelBase::tracksLoaded(AmarokSharedPointer<Meta::Album> const&, QModelIndex const&, QList<AmarokSharedPointer<Meta::Track> > const&) () at /usr/lib64/libamaroklib.so.1
Comment 3 Tuomas Nurmi 2022-12-24 11:33:08 UTC
Seems to happen at least when filtered results are found under both various artists and under single artists.
Reading docs ( https://doc.qt.io/qt-5/qmodelindex.html ),
"If you need to keep a model index over time use a QPersistentModelIndex."
is probably relevant here. I didn't do too deep analysis on the paths leading
here, but the crash is caused when the static_cast at row 444 of CollectionTreeItemModelBase.cpp
is erroneous (parent.internalPointer() seems to be a non-QObject). So something causes
a data-changing change when both kinds of results are in the filtering.
Seems to be fixed by having a QPersistentModelIndex instead.

A fix is submitted at
https://invent.kde.org/multimedia/amarok/-/merge_requests/50
Comment 4 Bernhard Kühnel 2023-01-02 21:27:17 UTC
Created attachment 154974 [details]
New crash information added by DrKonqi

amarok (2.9.71) using Qt 5.15.7

- when searching the collection (either by typing search terms or by selecting them from the advanced dialog), after submitting / shortly waiting, the application crashes before results become visible (i.e. before the collection tree seems to be refreshed)
- crashes are always reproducible with the same (affected) search terms
- some search terms yield results without a crash
- using an external mariadb with a very large collection

-- Backtrace (Reduced):
#4  QListData::isEmpty() const (this=0x560ef5c59cb0) at /usr/include/qt5/QtCore/qlist.h:116
#5  QList<CollectionTreeItem*>::isEmpty() const (this=0x560ef5c59cb0) at /usr/include/qt5/QtCore/qlist.h:201
#6  CollectionTreeItem::row() const (this=this@entry=0x7f1b4fbf6cc0) at /var/tmp/portage/media-sound/amarok-9999/work/amarok-9999/src/browsers/CollectionTreeItem.cpp:227
#7  0x00007f1b512541c0 in CollectionTreeItemModelBase::itemIndex(CollectionTreeItem*) const (item=0x7f1b4fbf6cc0, this=0x560ef3e50a60) at /var/tmp/portage/media-sound/amarok-9999/work/amarok-9999/src/browsers/CollectionTreeItemModelBase.cpp:582
#8  CollectionTreeItemModelBase::itemIndex(CollectionTreeItem*) const (this=0x560ef3e50a60, item=0x7f1b4fbf6cc0) at /var/tmp/portage/media-sound/amarok-9999/work/amarok-9999/src/browsers/CollectionTreeItemModelBase.cpp:577
Comment 5 Tuomas Nurmi 2023-02-08 06:08:20 UTC
Somewhy the automatic closing of a bug by a commit didn't kick in here. Anyway, this should be now fixed in current git head (since 7th Feb 2023) with https://invent.kde.org/multimedia/amarok/-/commit/2b1f73b0f6f3c3e63097b0820da4f6d12e5c377c?merge_request_iid=50
Comment 6 Heiko Becker 2023-06-09 19:26:57 UTC
*** Bug 466401 has been marked as a duplicate of this bug. ***
Comment 7 Nihin Dula 2023-06-09 19:42:01 UTC
 OpenSUSE Leap 15.5
amarok-2.9.75git.20221114T020258~457db492b4-bp155.1.12.x86_64

Bug not yet fixed.
Comment 8 Tuomas Nurmi 2023-06-09 19:51:47 UTC
(In reply to Nihin Dula from comment #7)
>  OpenSUSE Leap 15.5
> amarok-2.9.75git.20221114T020258~457db492b4-bp155.1.12.x86_64
> 
> Bug not yet fixed.

The version number "2.9.75git.20221114T" suggests that your version is built from sources dating November 2022 (hence 202211) git sources. Git states since February 2023 contain the fix, (e.g. 2.9.27git.2023048T114133 in Tumbleweed repo-oss and 2.9.27git.20230608T015352 in KDE:Unstable:Extra are available in my OpenSUSE repositories)
Comment 9 Tuomas Nurmi 2024-03-03 08:42:19 UTC
*** Bug 465602 has been marked as a duplicate of this bug. ***
Comment 10 Tuomas Nurmi 2024-03-23 19:03:21 UTC
*** Bug 481384 has been marked as a duplicate of this bug. ***