Bug 314046

Summary: Dolphin crashes when "show hidden files" is enabled and disabled
Product: dolphin Reporter: Romário Rios <luizromario>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: hrvoje.senjan, nortexoid
Priority: NOR Keywords: reproducible
Version: 16.12.2   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Proposed patch
New crash information added by DrKonqi
Improved patch

Description Romário Rios 2013-01-28 21:30:03 UTC
Application: dolphin (2.1.98)
KDE Platform Version: 4.9.97 (Compiled from sources)
Qt Version: 4.8.4
Operating System: Linux 3.7.4-1-ARCH x86_64

-- Information about the crash:
I enabled the "show hidden files" option from the keyboard shortcut "Alt+.". Then, whenever I tried to disable it by using the same shortcut, Dolphin crashed. The crash also happened when I tried to go to any other directory from Dolphin (by clicking a folder or typing it into the address bar). Tried in the / and /home directories.

This happened in the latest git snapshot.

The crash can be reproduced every time.

-- Backtrace:
Application: Dolphin (dolphin), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f89471247c0 (LWP 7881))]

Thread 2 (Thread 0x7f8928383700 (LWP 7884)):
#0  0x00007fffaa1ff8cf in clock_gettime ()
#1  0x00007f8941051b8d in clock_gettime () from /usr/lib/libc.so.6
#2  0x00007f8942083724 in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007f894215948d in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007f89421597d3 in ?? () from /usr/lib/libQtCore.so.4
#5  0x00007f894215823c in ?? () from /usr/lib/libQtCore.so.4
#6  0x00007f89421582e5 in ?? () from /usr/lib/libQtCore.so.4
#7  0x00007f893abdb3a8 in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#8  0x00007f893abdba3b in ?? () from /usr/lib/libglib-2.0.so.0
#9  0x00007f893abdbc34 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#10 0x00007f8942158b86 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#11 0x00007f89421293ff in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#12 0x00007f8942129688 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#13 0x00007f894202a8a0 in QThread::exec() () from /usr/lib/libQtCore.so.4
#14 0x00007f8942109bbf in ?? () from /usr/lib/libQtCore.so.4
#15 0x00007f894202d87c in ?? () from /usr/lib/libQtCore.so.4
#16 0x00007f893e79b124 in ?? () from /usr/lib/libGL.so.1
#17 0x00007f8941d9de0f in start_thread () from /usr/lib/libpthread.so.0
#18 0x00007f894103fefd in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7f89471247c0 (LWP 7881)):
[KCrash Handler]
#6  operator! (this=0x0) at /usr/include/QtCore/qshareddata.h:122
#7  KFileItem::url (this=0x0) at /home/kde4/kdesrc/kdelibs/kio/kio/kfileitem.cpp:1535
#8  0x00007f8946a4d90d in removeItems (items=..., this=0xeed6c0) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kfileitemmodel.cpp:1093
#9  KFileItemModel::removeItems (this=0xeed6c0, items=...) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kfileitemmodel.cpp:1032
#10 0x00007f8946a4e633 in KFileItemModel::slotItemsDeleted (this=0xeed6c0, items=...) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kfileitemmodel.cpp:799
#11 0x00007f894213fb8f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#12 0x00007f8945265e35 in KDirLister::itemsDeleted (this=<optimized out>, _t1=...) at /home/kde4/kdesrc/build/kdelibs/kio/kdirlister.moc:309
#13 0x00007f8945269c4f in KDirLister::Private::emitChanges (this=0xeed930) at /home/kde4/kdesrc/kdelibs/kio/kio/kdirlister.cpp:2209
#14 0x00007f8946a4c101 in KFileItemModel::setShowHiddenFiles (this=0xeed6c0, show=false) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kfileitemmodel.cpp:206
#15 0x00007f8946a9272f in DolphinView::setHiddenFilesShown (this=0xe6b160, show=<optimized out>) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/views/dolphinview.cpp:296
#16 0x00007f8946a3fc24 in qt_static_metacall (_a=<optimized out>, _id=<optimized out>, _o=<optimized out>, _c=<optimized out>) at /home/kde4/kdesrc/build/kde-baseapps/dolphin/src/moc_dolphinviewactionhandler.cpp:119
#17 DolphinViewActionHandler::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /home/kde4/kdesrc/build/kde-baseapps/dolphin/src/moc_dolphinviewactionhandler.cpp:91
#18 0x00007f894213fb8f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#19 0x00007f8943293f82 in QAction::triggered(bool) () from /usr/lib/libQtGui.so.4
#20 0x00007f8943294170 in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQtGui.so.4
#21 0x00007f89432942d7 in QAction::event(QEvent*) () from /usr/lib/libQtGui.so.4
#22 0x00007f8943ee0797 in KAction::event (this=<optimized out>, event=0x7fffaa0ed490) at /home/kde4/kdesrc/kdelibs/kdeui/actions/kaction.cpp:131
#23 0x00007f894329a18c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#24 0x00007f894329e60a in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#25 0x00007f8943fba2e6 in KApplication::notify (this=0x7fffaa0ee990, receiver=0xd8e980, event=0x7fffaa0ed490) at /home/kde4/kdesrc/kdelibs/kdeui/kernel/kapplication.cpp:311
#26 0x00007f894212a6ae in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#27 0x00007f89432cae44 in ?? () from /usr/lib/libQtGui.so.4
#28 0x00007f89432cc473 in ?? () from /usr/lib/libQtGui.so.4
#29 0x00007f89432a02e9 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#30 0x00007f8943fba2e6 in KApplication::notify (this=0x7fffaa0ee990, receiver=0xec4070, event=0x7fffaa0eda60) at /home/kde4/kdesrc/kdelibs/kdeui/kernel/kapplication.cpp:311
#31 0x00007f894212a6ae in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#32 0x00007f89433368fa in ?? () from /usr/lib/libQtGui.so.4
#33 0x00007f8943336d31 in ?? () from /usr/lib/libQtGui.so.4
#34 0x00007f8943314638 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#35 0x00007f894333aa22 in ?? () from /usr/lib/libQtGui.so.4
#36 0x00007f893abdb845 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#37 0x00007f893abdbb78 in ?? () from /usr/lib/libglib-2.0.so.0
#38 0x00007f893abdbc34 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#39 0x00007f8942158b66 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#40 0x00007f894333a69e in ?? () from /usr/lib/libQtGui.so.4
#41 0x00007f89421293ff in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#42 0x00007f8942129688 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#43 0x00007f894212e328 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#44 0x00007f8946d22744 in kdemain (argc=1, argv=0x7fffaa0eeac8) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/main.cpp:93
#45 0x00007f8940f78a15 in __libc_start_main () from /usr/lib/libc.so.6
#46 0x0000000000400891 in _start ()

Reported using DrKonqi
Comment 1 Frank Reininghaus 2013-01-29 07:10:29 UTC
Thanks for the bug report! I can confirm this in master. This is caused by a recent change (which is not in the KDE/4.10 branch, by the way). I'll have a look as soon as possible.
Comment 2 Frank Reininghaus 2013-01-29 07:38:46 UTC
Created attachment 76782 [details]
Proposed patch

This crash is caused by https://git.reviewboard.kde.org/r/108540/, which makes changes to KFileItemModel::removeItems() that greatly improve the performance if many items are removed from the view. We do have some unit tests for that function, but the crash only happens if the positions where the items are removed have a certain structure, which often occurs when hidden files are hidden, but not in the existing unit tests.

Could you check if the patch also works for you? If yes, I'll add a new unit test to make sure that the crash does not come back and commit the fix soon.

Thanks again for your report! Testing changes in master early and reporting any regressions is extremely helpful for us and prevents that many people suffer from such bugs.
Comment 3 Frank Reininghaus 2013-01-29 08:07:48 UTC
(In reply to comment #2)
> We do have some unit
> tests for that function, but the crash only happens if the positions where
> the items are removed have a certain structure, which often occurs when
> hidden files are hidden, but not in the existing unit tests.

Just for the record: the structure that is required to get the crash is that the removed items are in at least two groups, and there are some items remaining after the last of these groups. This happens to be the case if you have 'sort folders first' enabled, and you have both files and folders which are hidden and also both files and folders which are not hidden.
Comment 4 Romário Rios 2013-01-29 12:43:10 UTC
(In reply to comment #2)
> Could you check if the patch also works for you? If yes, I'll add a new unit
> test to make sure that the crash does not come back and commit the fix soon.
It works partially. Now I can unset "Show hidden files", but clicking in any folder when it's active still crashes.
Comment 5 Romário Rios 2013-01-29 12:46:03 UTC
(In reply to comment #4)
> (In reply to comment #2)
> > Could you check if the patch also works for you? If yes, I'll add a new unit
> > test to make sure that the crash does not come back and commit the fix soon.
> It works partially. Now I can unset "Show hidden files", but clicking in any
> folder when it's active still crashes.

Backtrace:
Application: Dolphin (dolphin), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f51943dd7c0 (LWP 16604))]

Thread 4 (Thread 0x7f517563c700 (LWP 16607)):
#0  0x00007f518e2effad in poll () from /usr/lib/libc.so.6
#1  0x00007f5187e94b14 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007f5187e94c34 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007f518f411b86 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007f518f3e23ff in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007f518f3e2688 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007f518f2e38a0 in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007f518f3c2bbf in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007f518f2e687c in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007f518ba54124 in ?? () from /usr/lib/libGL.so.1
#10 0x00007f518f056e0f in start_thread () from /usr/lib/libpthread.so.0
#11 0x00007f518e2f8efd in clone () from /usr/lib/libc.so.6

Thread 3 (Thread 0x7f5174abb700 (LWP 16612)):
#0  0x00007f518f05ad01 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007f518f2e6d37 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f518f2da54f in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007f518f2e687c in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007f518ba54124 in ?? () from /usr/lib/libGL.so.1
#5  0x00007f518f056e0f in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f518e2f8efd in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7f516ffff700 (LWP 16613)):
#0  0x00007f518e2f1d53 in select () from /usr/lib/libc.so.6
#1  0x00007f518f3c21f2 in ?? () from /usr/lib/libQtCore.so.4
#2  0x00007f518f2e687c in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007f518ba54124 in ?? () from /usr/lib/libGL.so.1
#4  0x00007f518f056e0f in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007f518e2f8efd in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7f51943dd7c0 (LWP 16604)):
[KCrash Handler]
#6  removeItems (items=..., this=0x143c0b0) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kfileitemmodel.cpp:1071
#7  KFileItemModel::removeItems (this=0x143c0b0, items=...) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kfileitemmodel.cpp:1032
#8  0x00007f5193d07643 in KFileItemModel::slotItemsDeleted (this=0x143c0b0, items=...) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kfileitemmodel.cpp:799
#9  0x00007f518f3f8b8f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#10 0x00007f519251ee35 in KDirLister::itemsDeleted (this=<optimized out>, _t1=...) at /home/kde4/kdesrc/build/kdelibs/kio/kdirlister.moc:309
#11 0x00007f5192522c4f in KDirLister::Private::emitChanges (this=0x143c320) at /home/kde4/kdesrc/kdelibs/kio/kio/kdirlister.cpp:2209
#12 0x00007f5193d05101 in KFileItemModel::setShowHiddenFiles (this=0x143c0b0, show=false) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kfileitemmodel.cpp:206
#13 0x00007f5193d49634 in DolphinView::applyViewProperties (this=this@entry=0x148a8c0) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/views/dolphinview.cpp:1451
#14 0x00007f5193d49c67 in DolphinView::setUrl (this=0x148a8c0, url=...) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/views/dolphinview.cpp:617
#15 0x00007f5193fd5103 in DolphinViewContainer::slotItemActivated (this=0x1361930, item=...) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/dolphinviewcontainer.cpp:485
#16 0x00007f5193fd6f5e in qt_static_metacall (_a=<optimized out>, _id=<optimized out>, _o=<optimized out>, _c=<optimized out>) at /home/kde4/kdesrc/build/kde-baseapps/dolphin/src/dolphinviewcontainer.moc:120
#17 DolphinViewContainer::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /home/kde4/kdesrc/build/kde-baseapps/dolphin/src/dolphinviewcontainer.moc:102
#18 0x00007f518f3f8b8f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#19 0x00007f5193d47155 in DolphinView::itemActivated (this=this@entry=0x148a8c0, _t1=...) at /home/kde4/kdesrc/build/kde-baseapps/dolphin/src/dolphinview.moc:346
#20 0x00007f5193d4718d in DolphinView::slotItemActivated (this=0x148a8c0, index=<optimized out>) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/views/dolphinview.cpp:789
#21 0x00007f5193d4ccd0 in qt_static_metacall (_a=<optimized out>, _id=<optimized out>, _o=<optimized out>, _c=<optimized out>) at /home/kde4/kdesrc/build/kde-baseapps/dolphin/src/dolphinview.moc:245
#22 DolphinView::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /home/kde4/kdesrc/build/kde-baseapps/dolphin/src/dolphinview.moc:193
#23 0x00007f518f3f8b8f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#24 0x00007f5193d1439e in KItemListController::itemActivated (this=this@entry=0x120e670, _t1=_t1@entry=15) at /home/kde4/kdesrc/build/kde-baseapps/dolphin/src/kitemlistcontroller.moc:211
#25 0x00007f5193d16185 in KItemListController::mouseReleaseEvent (this=0x120e670, event=0x7fff4b8e3760, transform=...) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kitemlistcontroller.cpp:763
#26 0x00007f5193d136de in KItemListController::processEvent (this=0x120e670, event=0x1, event@entry=0x7fff4b8e3760, transform=...) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kitemlistcontroller.cpp:997
#27 0x00007f5193d1b13b in KItemListView::event (this=0x143ce70, event=0x7fff4b8e3760) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/kitemviews/kitemlistview.cpp:868
#28 0x00007f519055318c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#29 0x00007f519055760a in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#30 0x00007f51912732e6 in KApplication::notify (this=0x7fff4b8e4d10, receiver=0x143ce70, event=0x7fff4b8e3760) at /home/kde4/kdesrc/kdelibs/kdeui/kernel/kapplication.cpp:311
#31 0x00007f518f3e36ae in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#32 0x00007f5190b37e1b in ?? () from /usr/lib/libQtGui.so.4
#33 0x00007f5190b38a00 in ?? () from /usr/lib/libQtGui.so.4
#34 0x00007f5190b393f5 in QGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent*) () from /usr/lib/libQtGui.so.4
#35 0x00007f5190b4c14c in QGraphicsScene::event(QEvent*) () from /usr/lib/libQtGui.so.4
#36 0x00007f519055318c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#37 0x00007f519055760a in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#38 0x00007f51912732e6 in KApplication::notify (this=0x7fff4b8e4d10, receiver=0x147ec00, event=0x7fff4b8e3760) at /home/kde4/kdesrc/kdelibs/kdeui/kernel/kapplication.cpp:311
#39 0x00007f518f3e36ae in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#40 0x00007f5190b624e1 in QGraphicsView::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#41 0x00007f51905a2a49 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#42 0x00007f519094dd36 in QFrame::event(QEvent*) () from /usr/lib/libQtGui.so.4
#43 0x00007f5190b6595b in QGraphicsView::viewportEvent(QEvent*) () from /usr/lib/libQtGui.so.4
#44 0x00007f518f3e3816 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#45 0x00007f519055315c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#46 0x00007f5190557e6b in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#47 0x00007f51912732e6 in KApplication::notify (this=0x7fff4b8e4d10, receiver=0x13ec400, event=0x7fff4b8e4090) at /home/kde4/kdesrc/kdelibs/kdeui/kernel/kapplication.cpp:311
#48 0x00007f518f3e36ae in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#49 0x00007f5190553fcb in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#50 0x00007f51905cead4 in ?? () from /usr/lib/libQtGui.so.4
#51 0x00007f51905cd861 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#52 0x00007f51905f3a22 in ?? () from /usr/lib/libQtGui.so.4
#53 0x00007f5187e94845 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#54 0x00007f5187e94b78 in ?? () from /usr/lib/libglib-2.0.so.0
#55 0x00007f5187e94c34 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#56 0x00007f518f411b66 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#57 0x00007f51905f369e in ?? () from /usr/lib/libQtGui.so.4
#58 0x00007f518f3e23ff in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#59 0x00007f518f3e2688 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#60 0x00007f518f3e7328 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#61 0x00007f5193fdb744 in kdemain (argc=1, argv=0x7fff4b8e4e48) at /home/kde4/kdesrc/kde-baseapps/dolphin/src/main.cpp:93
#62 0x00007f518e231a15 in __libc_start_main () from /usr/lib/libc.so.6
#63 0x0000000000400891 in _start ()
Comment 6 Hrvoje Senjan 2013-01-29 14:50:31 UTC
Created attachment 76785 [details]
New crash information added by DrKonqi

dolphin (2.1.98) on KDE Platform 4.10.60 "release 59" using Qt 4.8.5

- What I was doing when the application crashed:

Frank, i'm not 100% sure the cause is the same, but i get 100% crashing when trying to filter items with latest master. For reproducing it's enough to try to filter items --> Ctrl + I, and as soon as i type a letter, dolphin crashes.

-- Backtrace (Reduced):
#6  operator! (this=0x0) at /usr/include/QtCore/qshareddata.h:122
#7  KFileItem::url (this=0x0) at /usr/src/debug/kdelibs-git/kio/kio/kfileitem.cpp:1535
#8  0x00007f4be84b2ded in removeItems (items=..., this=0x1968500) at /usr/src/debug/kde-baseapps-git/dolphin/src/kitemviews/kfileitemmodel.cpp:1093
#9  KFileItemModel::removeItems (this=0x1968500, items=...) at /usr/src/debug/kde-baseapps-git/dolphin/src/kitemviews/kfileitemmodel.cpp:1032
#10 0x00007f4be84b3ecc in KFileItemModel::applyFilters (this=this@entry=0x1968500) at /usr/src/debug/kde-baseapps-git/dolphin/src/kitemviews/kfileitemmodel.cpp:557
Comment 7 Hrvoje Senjan 2013-01-29 15:31:50 UTC
(In reply to comment #6)
> Created attachment 76785 [details]
> New crash information added by DrKonqi
> 
> dolphin (2.1.98) on KDE Platform 4.10.60 "release 59" using Qt 4.8.5
> 
> - What I was doing when the application crashed:
> 
> Frank, i'm not 100% sure the cause is the same, but i get 100% crashing when
> trying to filter items with latest master. For reproducing it's enough to
> try to filter items --> Ctrl + I, and as soon as i type a letter, dolphin
> crashes.
Actually, it crashes every time and only when there are several directories with the same "pattern". Seems that when files are filtered out, works fine.
Comment 8 Frank Reininghaus 2013-01-29 15:39:56 UTC
Created attachment 76786 [details]
Improved patch

@Hrvoje: Yes, I'm pretty sure that it's due to the same bug in the code.

@Romário: You're right. I had not noticed that this crash still happens first because it seems that it depends on the "Save view properties for all folders" setting. It's a slightly different issue caused by the same commit. The problem when changing the folder is:

1. All items are removed from the model.

2. When entering a folder for which "Show hidden files" is disabled, the KDirLister, which is still watching the previous folder, signals that the hidden files should be cleared from the model.

3. However, these files are not in the model anymore (Dolphin outputs warning messages about that when running it in a Konsole). Therefore, when the function tries to access the first of the 'removed ranges' (it implicitly assumes that there is always at least one 'removed range'), it crashes.

The new patch should fix that. If you still find similar crashes in KFileItemModel::removeItems() with the new patch applied, please let me know. Thanks for your help!
Comment 9 Hrvoje Senjan 2013-01-29 16:28:50 UTC
Frank, thanks, your patch #2 fixed both the original and the filter issue for me :-)
Comment 10 Frank Reininghaus 2013-01-29 18:13:24 UTC
Git commit 8a8854a772ca02ad538a9389c7be92fb45f9acac by Frank Reininghaus.
Committed on 29/01/2013 at 19:08.
Pushed by freininghaus into branch 'master'.

Fix crashes in KFileItemModel::removeItems()

These crashes were caused by the recent commit
ff3267c6dcd0f6d0621b3a96b5462a9581a03883. It introduced two problems:

a) A logic error in the code that removes the ItemData pointers from
   m_itemData that could cause crashes if multiple item ranges are
   removed, and there were un-removed items behind the last one.
b) The implicit assumption that any call of removeItems() will actually
   result in items being removed in the model. This is incorrect if
   the model is first cleared and then the hidden-files setting is
   modified, which happens if "Save view properties for each folder" is
   enabled, and a folder where hidden files are shown is left. In that
   case, the dir lister emits itemsDeleted for the hidden items after
   they have been removed from the model due to the folder change.

I'll add a unit test covering these issues soon.

Many thanks to Romário Rios and Hrvoje Senjan for testing!

M  +9    -4    dolphin/src/kitemviews/kfileitemmodel.cpp

http://commits.kde.org/kde-baseapps/8a8854a772ca02ad538a9389c7be92fb45f9acac
Comment 11 Frank Reininghaus 2013-01-30 20:04:36 UTC
Git commit 5a1d7559198a4b314d022481763396442164e11d by Frank Reininghaus.
Committed on 30/01/2013 at 21:02.
Pushed by freininghaus into branch 'KDE/4.10'.

Add unit test for bug 314046

The regression happened in the master branch only, but I think it
doesn't hurt to add the test to the stable branch.

M  +51   -0    dolphin/src/tests/kfileitemmodeltest.cpp

http://commits.kde.org/kde-baseapps/5a1d7559198a4b314d022481763396442164e11d
Comment 12 Michael D 2015-10-12 09:12:52 UTC
I know this is a really old bug, but it has just resurfaced on my machine running Plasma version 5.4.2, Dolphin version 15.08.1. Setting HiddenFilesShown=true
 in .directory of directory X causes Dolphin to crash when navigating to X.