Bug 439622

Summary: Dolphin crashes when pointing Trash to /dev/null
Product: [Applications] dolphin Reporter: Thomas Faber <kde>
Component: panels: placesAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: groot, kfm-devel, nate
Priority: VLO Keywords: drkonqi
Version: 21.04.2   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:

Description Thomas Faber 2021-07-08 01:57:10 UTC
Application: dolphin (21.04.2)

Qt Version: 5.15.2
Frameworks Version: 5.83.0
Operating System: Linux 5.12.13-300.fc34.x86_64 x86_64
Windowing System: Wayland
Drkonqi Version: 5.22.2
Distribution: Fedora 34 (Workstation Edition)

-- Information about the crash:
- What I was doing when the application crashed:
In the left side bar under Places, right click Trash and select "Edit...". Change location to /dev/null, click OK.

The crash can be reproduced every time.

-- Backtrace:
Application: Dolphin (dolphin), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f7dcb844ee4 in KIconButton::icon() const () from /lib64/libKF5IconThemes.so.5
#5  0x00007f7dcc03b1a1 in KFilePlaceEditDialog::icon() const () from /lib64/libKF5KIOFileWidgets.so.5
#6  0x00007f7dcc42b6bc in PlacesPanel::slotItemContextMenuRequested(int, QPointF const&) () from /lib64/libkdeinit5_dolphin.so
#7  0x00007f7dca26ac99 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#8  0x00007f7dcc10a78a in KItemListController::itemContextMenuRequested(int, QPointF const&) () from /lib64/libdolphinprivate.so.5
#9  0x00007f7dcc13ee39 in KItemListController::onPress(QPoint const&, QPointF const&, QFlags<Qt::KeyboardModifier>, QFlags<Qt::MouseButton>) () from /lib64/libdolphinprivate.so.5
#10 0x00007f7dcc1371f5 in KItemListController::mousePressEvent(QGraphicsSceneMouseEvent*, QTransform const&) () from /lib64/libdolphinprivate.so.5
#11 0x00007f7dcc143669 in KItemListController::processEvent(QEvent*, QTransform const&) () from /lib64/libdolphinprivate.so.5
#12 0x00007f7dcc143741 in KItemListView::event(QEvent*) () from /lib64/libdolphinprivate.so.5
#13 0x00007f7dcadd4423 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#14 0x00007f7dca237098 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#15 0x00007f7dcb112945 in QGraphicsScenePrivate::sendEvent(QGraphicsItem*, QEvent*) () from /lib64/libQt5Widgets.so.5
#16 0x00007f7dcb112d01 in QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent*) () from /lib64/libQt5Widgets.so.5
#17 0x00007f7dcb11b5ca in QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent*) () from /lib64/libQt5Widgets.so.5
#18 0x00007f7dcb125521 in QGraphicsScene::event(QEvent*) () from /lib64/libQt5Widgets.so.5
#19 0x00007f7dcadd4423 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#20 0x00007f7dca237098 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#21 0x00007f7dcb142ff5 in QGraphicsView::mousePressEvent(QMouseEvent*) () from /lib64/libQt5Widgets.so.5
#22 0x00007f7dcae16dbe in QWidget::event(QEvent*) () from /lib64/libQt5Widgets.so.5
#23 0x00007f7dcaec45b2 in QFrame::event(QEvent*) () from /lib64/libQt5Widgets.so.5
#24 0x00007f7dca236e4d in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#25 0x00007f7dcadd4412 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#26 0x00007f7dcaddc054 in QApplication::notify(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#27 0x00007f7dca237098 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#28 0x00007f7dcaddab37 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /lib64/libQt5Widgets.so.5
#29 0x00007f7dcae30530 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () from /lib64/libQt5Widgets.so.5
#30 0x00007f7dcae337c5 in QWidgetWindow::event(QEvent*) () from /lib64/libQt5Widgets.so.5
#31 0x00007f7dcadd4423 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#32 0x00007f7dca237098 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#33 0x00007f7dca751db8 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /lib64/libQt5Gui.so.5
#34 0x00007f7dca731d0c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Gui.so.5
#35 0x00007f7dc7bf18a4 in userEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQt5WaylandClient.so.5
#36 0x00007f7dc81524cf in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#37 0x00007f7dc81a64e8 in g_main_context_iterate.constprop () from /lib64/libglib-2.0.so.0
#38 0x00007f7dc814fc03 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#39 0x00007f7dca288698 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#40 0x00007f7dca235ab2 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#41 0x00007f7dca23dfe4 in QCoreApplication::exec() () from /lib64/libQt5Core.so.5
#42 0x00007f7dcc40419e in kdemain () from /lib64/libkdeinit5_dolphin.so
#43 0x00007f7dcc204b75 in ?? () from /lib64/libc.so.6
#44 0x000055db9724f0ae in _start ()
[Inferior 1 (process 15282) detached]

Reported using DrKonqi
Comment 1 groot 2021-07-08 11:31:15 UTC
Aside from "don't do that then" (/dev/null is not a directory and you can't move files to "inside" it, just like you couldn't use /dev/ttyS0 to send trashed-files to a serial-port-attached-paper-shredder), this shouldn't crash dolphin.

Confirmed on X11/FreeBSD (Frameworks 5.82)
Comment 2 Nate Graham 2021-07-08 13:12:17 UTC
Yeah this definitely seems like a "Don't do that" situation. :) But indeed, it should not crash if you do.
Comment 3 Bug Janitor Service 2021-08-13 13:10:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/544
Comment 4 Jan Paul Batrina 2021-08-29 11:38:36 UTC
Git commit 9f6f1c5506b714e049977a4868723b2b2529aed4 by Jan Paul Batrina.
Committed on 29/08/2021 at 04:22.
Pushed by ahmadsamir into branch 'master'.

KFilePlaceEditDialog: Always preserve previous icon

When the original item's url is trash:/, m_iconButton wasn't
instantiated since isIconEditable() will return false. If the url is
edited to point somewhere else, isIconEditable() will return false,
making the check in KFilePlaceEditDialog::icon() fail to guard access
to m_iconButton which points to nullptr. This crash can be seen by
trying to change the "Trash" entry's location in Dolphin's Places panel.

This patch makes it so that m_iconButton is always instantiated to
prevent the crash and also to always preserve the original icon before editing.

M  +16   -17   src/filewidgets/kfileplaceeditdialog.cpp

https://invent.kde.org/frameworks/kio/commit/9f6f1c5506b714e049977a4868723b2b2529aed4