Bug 428535

Summary: Dolphin crashes in KFileItemModel::ItemData::~ItemData() when I empty trash
Product: [Applications] dolphin Reporter: Łukasz Konieczny <ftefrjbhfvasf32>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Severity: crash CC: ftefrjbhfvasf32, kfm-devel, meven.car, meven29, nate
Priority: NOR Keywords: drkonqi
Version: 20.08.2   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=426657
Latest Commit: Version Fixed In:

Description Łukasz Konieczny 2020-10-31 22:38:26 UTC
Application: dolphin (20.08.2)

Qt Version: 5.14.2
Frameworks Version: 5.74.0
Operating System: Linux 5.8.0-26-generic x86_64
Windowing system: X11
Distribution: Ubuntu 20.10

-- Information about the crash:
- What I was doing when the application crashed:

I went to Trash where I had about 400 MiB of data and attempted to empty the Trash. Every item in Trash was duplicated, which I thought was strange. When I hit "Empty Trash" button, Dolphin crashed.

The crash can be reproduced every time.

-- Backtrace:
Application: Dolphin (dolphin), signal: Segmentation fault
Content of s_kcrashErrorMessage: (null)
[KCrash Handler]
#6  QSharedDataPointer<KFileItemPrivate>::~QSharedDataPointer (this=0x55e2e539e650, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/atomic_base.h:333
#7  0x00007fa7e91e18be in KFileItemModel::ItemData::~ItemData (this=0x55e2e539e650, __in_chrg=<optimized out>) at ./src/kitemviews/kfileitemmodel.h:298
#8  qDeleteAll<QList<KFileItemModel::ItemData*>::const_iterator> (end=..., begin=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qalgorithms.h:320
#9  qDeleteAll<QList<KFileItemModel::ItemData*> > (c=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qalgorithms.h:328
#10 KFileItemModel::slotClear (this=0x55e2e563cb90) at ./src/kitemviews/kfileitemmodel.cpp:1155
#11 0x00007fa7e73e42e6 in QtPrivate::QSlotObjectBase::call (a=0x7ffc7b51a620, r=0x55e2e563cb90, this=0x55e2e4b27040) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#12 doActivate<false> (sender=0x55e2e55fc290, signal_index=10, argv=0x7ffc7b51a620, argv@entry=0x0) at kernel/qobject.cpp:3870
#13 0x00007fa7e73de068 in QMetaObject::activate (sender=sender@entry=0x55e2e55fc290, m=m@entry=0x7fa7e8d65100 <KCoreDirLister::staticMetaObject>, local_signal_index=local_signal_index@entry=7, argv=argv@entry=0x0) at kernel/qobject.cpp:3930
#14 0x00007fa7e8cea547 in KCoreDirLister::clear (this=this@entry=0x55e2e55fc290) at ./obj-x86_64-linux-gnu/src/core/KF5KIOCore_autogen/include/moc_kcoredirlister.cpp:460
#15 0x00007fa7e8cfcb3e in KCoreDirListerCache::forgetDirs (this=this@entry=0x7fa7e8d684e0 <(anonymous namespace)::Q_QGS_kDirListerCache::innerFunction()::holder>, lister=0x55e2e55fc290) at ./src/core/kcoredirlister.cpp:490
#16 0x00007fa7e8cfd31a in KCoreDirListerCache::listDir (this=0x7fa7e8d684e0 <(anonymous namespace)::Q_QGS_kDirListerCache::innerFunction()::holder>, lister=<optimized out>, _u=..., _keep=<optimized out>, _reload=<optimized out>) at ./src/core/kcoredirlister.cpp:125
#17 0x00007fa7e91ec382 in KFileItemModel::refreshDirectory (this=0x55e2e563cb90, url=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qflags.h:118
#18 0x00007fa7e9243dcf in DolphinView::reload (this=0x55e2e537d4d0) at ./src/views/dolphinview.cpp:463
#19 0x00007fa7e94e68f1 in DolphinViewContainer::reload (this=0x55e2e53dfcc0) at ./src/dolphinviewcontainer.cpp:456
#20 0x00007fa7e94d1662 in DolphinMainWindow::reloadView (this=0x55e2e44ccdc0) at ./src/dolphinmainwindow.cpp:805
#21 0x00007fa7e73e42e6 in QtPrivate::QSlotObjectBase::call (a=0x7ffc7b51a9f0, r=0x55e2e44ccdc0, this=0x55e2e4550b70) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#22 doActivate<false> (sender=0x55e2e453e520, signal_index=4, argv=argv@entry=0x7ffc7b51a9f0) at kernel/qobject.cpp:3870
#23 0x00007fa7e73de068 in QMetaObject::activate (sender=sender@entry=0x55e2e453e520, m=m@entry=0x7fa7e8427f00 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7ffc7b51a9f0) at kernel/qobject.cpp:3930
#24 0x00007fa7e7f1f826 in QAction::triggered (this=this@entry=0x55e2e453e520, _t1=<optimized out>) at .moc/moc_qaction.cpp:381
#25 0x00007fa7e7f22111 in QAction::activate (this=0x55e2e453e520, event=<optimized out>) at kernel/qaction.cpp:1161
#26 0x00007fa7e8017202 in QAbstractButtonPrivate::click (this=this@entry=0x55e2e46e34f0) at widgets/qabstractbutton.cpp:909
#27 0x00007fa7e8017325 in QAbstractButton::mouseReleaseEvent (this=0x55e2e470c050, e=0x7ffc7b51afc0) at widgets/qabstractbutton.cpp:1012
#28 0x00007fa7e810959e in QToolButton::mouseReleaseEvent (this=<optimized out>, e=<optimized out>) at widgets/qtoolbutton.cpp:622
#29 0x00007fa7e7f6730e in QWidget::event (this=0x55e2e470c050, event=0x7ffc7b51afc0) at kernel/qwidget.cpp:9033
#30 0x00007fa7e7f26013 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x55e2e470c050, e=0x7ffc7b51afc0) at kernel/qapplication.cpp:3685
#31 0x00007fa7e7f2b841 in QApplication::notify(QObject*, QEvent*) () at kernel/qapplication.cpp:3129
#32 0x00007fa7e73ae1ca in QCoreApplication::notifyInternal2 (receiver=0x55e2e470c050, event=0x7ffc7b51afc0) at ../../include/QtCore/../../src/corelib/kernel/qobject.h:153
#33 0x00007fa7e7f2a73a in QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x55e2e470c050, event=event@entry=0x7ffc7b51afc0, alienWidget=alienWidget@entry=0x55e2e470c050, nativeWidget=0x55e2e44ccdc0, buttonDown=<optimized out>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2615
#34 0x00007fa7e7f7ff32 in QWidgetWindow::handleMouseEvent (this=0x55e2e47333b0, event=0x7ffc7b51b280) at /usr/include/c++/10/bits/atomic_base.h:420
#35 0x00007fa7e7f82d8e in QWidgetWindow::event (this=0x55e2e47333b0, event=0x7ffc7b51b280) at kernel/qwidgetwindow.cpp:295
#36 0x00007fa7e7f26013 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x55e2e47333b0, e=0x7ffc7b51b280) at kernel/qapplication.cpp:3685
#37 0x00007fa7e73ae1ca in QCoreApplication::notifyInternal2 (receiver=0x55e2e47333b0, event=0x7ffc7b51b280) at ../../include/QtCore/../../src/corelib/kernel/qobject.h:153
#38 0x00007fa7e784148b in QGuiApplicationPrivate::processMouseEvent (e=0x55e2e4c9e670) at kernel/qguiapplication.cpp:2203
#39 0x00007fa7e78172bb in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1170
#40 0x00007fa7e210035e in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#41 0x00007fa7e52e84db in g_main_dispatch (context=0x7fa7dc005000) at ../../../glib/gmain.c:3325
#42 g_main_context_dispatch (context=0x7fa7dc005000) at ../../../glib/gmain.c:4016
#43 0x00007fa7e52e8788 in g_main_context_iterate (context=context@entry=0x7fa7dc005000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4092
#44 0x00007fa7e52e8853 in g_main_context_iteration (context=0x7fa7dc005000, may_block=may_block@entry=1) at ../../../glib/gmain.c:4157
#45 0x00007fa7e7405843 in QEventDispatcherGlib::processEvents (this=0x55e2e447d720, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#46 0x00007fa7e73aca4b in QEventLoop::exec (this=this@entry=0x7ffc7b51b5b0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:136
#47 0x00007fa7e73b4fc6 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:118
#48 0x00007fa7e7834de0 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1860
#49 0x00007fa7e7f25f89 in QApplication::exec () at kernel/qapplication.cpp:2825
#50 0x00007fa7e94d07c5 in kdemain (argc=<optimized out>, argv=0x7ffc7b51b6b8) at ./src/main.cpp:206
#51 0x00007fa7e92c0cb2 in __libc_start_main (main=0x55e2e27a3060 <main>, argc=1, argv=0x7ffc7b51b878, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc7b51b868) at ../csu/libc-start.c:314
#52 0x000055e2e27a309e in _start ()
[Inferior 1 (process 4017) detached]

Possible duplicates by query: bug 428384, bug 425753, bug 424909, bug 423506, bug 422194.

Reported using DrKonqi
Comment 1 Méven Car 2020-11-05 06:00:53 UTC
Thank you for this bug report.

Do you have any idea how you managed to get items duplicated ?

This is most likely the bug origin causing later a double free causing this crash.
Comment 2 Łukasz Konieczny 2020-11-05 12:40:44 UTC
I don't have any idea. Perhaps Dolphin has problems if there are too large files in trash? I had some large files then and total amount of used space in trash was around 400 MiB.
Comment 3 Méven Car 2020-11-05 12:49:24 UTC
(In reply to Łukasz Konieczny from comment #2)
> I don't have any idea. Perhaps Dolphin has problems if there are too large
> files in trash? I had some large files then and total amount of used space
> in trash was around 400 MiB.

The issue comes from a logic issue. File size in inconsequential most likely.

Is there double files in ~/.local/share/Trash/info/ as well compared to the trash "real" content in "~/.local/share/Trash/files" ?
Comment 4 Christoph Feck 2020-11-05 13:18:48 UTC
Duplicate entries where also seen by other reporters; might be caused by the Tree view mode. Do you use this?

See also bug 426657.
Comment 5 Łukasz Konieczny 2020-11-05 14:16:24 UTC
I have thrown 7.4 GiB of data into trash. Dolphin duplicates files in trash and crashes even when I go back from trash to earlier directory.

@Christoph Feck
[[[Duplicate entries where also seen by other reporters; might be caused by the Tree view mode. Do you use this?]]]

No matter which view mode I use, Dolphin shows duplicated files in trash. I have thrown 3 files, Dolphin shows 6.

@Méven Car
[[[Is there double files in ~/.local/share/Trash/info/ as well compared to the trash "real" content in "~/.local/share/Trash/files" ?]]]

In both directories mentioned by you I have now 3 files. There is everything OK. Dolphin only erratically shows 6 files in trash:/

Moreover, Dolphin doesn't show duplicated files every time. It only shows duplicated files every time I move to trash some large files. Now I have thrown to trash three files which are 7.4 GiB in total. Dolphin showed them duplicated, then crashed when I went back to earlier directory. When I launched Dolphin once again, those files in trash were not duplicated. I could then empty the trash successfully.
Comment 6 Łukasz Konieczny 2020-11-05 14:24:28 UTC
Perhaps the problem is caused by tree view mode. I wrote that problem occurs no matter which view mode I choose. But I had initially tree view mode. When I set view to icon view mode and threw those files to trash, they were not duplicated.
Comment 7 Christoph Feck 2020-12-29 10:23:46 UTC
Resolving according to comment 6.

*** This bug has been marked as a duplicate of bug 422282 ***