Bug 469586

Summary: Dolphin crashed when closed while undoing mass renaming
Product: [Applications] dolphin Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: akselmo, kfm-devel, nate
Priority: NOR Keywords: drkonqi
Version: 23.04.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 6.0
Sentry Crash Report:

Description Patrick Silva 2023-05-10 16:44:18 UTC
Application: dolphin (23.04.0)

Qt Version: 5.15.9
Frameworks Version: 5.105.0
Operating System: Linux 6.3.1-arch1-1 x86_64
Windowing System: Wayland
Distribution: "Arch Linux"
DrKonqi: 5.27.5 [KCrashBackend]

-- Information about the crash:
I renamed 2048 .jpg files at once, pressed ctrl+z to undo the mass renaming, pressed ctrl+q while Dolphin was undoing the mass renaming, then Plasma shown a crash notification.

The reporter is unsure if this crash is reproducible.

-- Backtrace:
Application: Dolphin (dolphin), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>}
[KCrash Handler]
#6  std::__uniq_ptr_impl<QTLWExtra, std::default_delete<QTLWExtra> >::_M_ptr() const (this=0x65006d00610056, this=<optimized out>) at /usr/include/c++/12.2.1/bits/unique_ptr.h:191
#7  std::unique_ptr<QTLWExtra, std::default_delete<QTLWExtra> >::get() const (this=0x65006d00610056, this=<optimized out>) at /usr/include/c++/12.2.1/bits/unique_ptr.h:462
#8  QWidgetPrivate::maybeTopData() const (this=0x5635b4f91cd0) at ../../include/QtWidgets/5.15.9/QtWidgets/private/../../../../../src/widgets/kernel/qwidget_p.h:820
#9  QWidgetPrivate::windowHandle(QWidgetPrivate::WindowHandleMode) const (this=0x5635b4f91cd0, mode=QWidgetPrivate::WindowHandleMode::Direct) at kernel/qwidget.cpp:1086
#10 0x00007fb3e4e66b3b in KJobWidgets::setWindow(KJob*, QWidget*) (job=0x5635b3950b90, widget=<optimized out>) at /usr/src/debug/kjobwidgets/kjobwidgets-5.105.0/src/kjobwidgets.cpp:17
#11 0x00007fb3e4f79f44 in KIO::FileUndoManagerPrivate::undoStep() (this=0x5635b3584760) at /usr/src/debug/kio/kio-5.105.0/src/widgets/fileundomanager.cpp:526
#12 0x00007fb3e30beb41 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffd59535120, r=<optimized out>, this=0x5635b3832970, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#13 doActivate<false>(QObject*, int, void**) (sender=0x5635b42642e0, signal_index=6, argv=0x7ffd59535120) at kernel/qobject.cpp:3923
#14 0x00007fb3e45597da in KJob::result(KJob*, KJob::QPrivateSignal) (this=this@entry=0x5635b42642e0, _t1=<optimized out>, _t1@entry=0x5635b42642e0, _t2=...) at /usr/src/debug/kcoreaddons/build/src/lib/KF5CoreAddons_autogen/include/moc_kjob.cpp:633
#15 0x00007fb3e455f52c in KJob::finishJob(bool) (this=0x5635b42642e0, emitResult=<optimized out>) at /usr/src/debug/kcoreaddons/kcoreaddons-5.105.0/src/lib/jobs/kjob.cpp:98
#16 0x00007fb3e30beb41 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffd595351f0, r=<optimized out>, this=0x5635b37ec0c0, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#17 doActivate<false>(QObject*, int, void**) (sender=0x5635b6cd7ee0, signal_index=7, argv=0x7ffd595351f0) at kernel/qobject.cpp:3923
#18 0x00007fb3e4d1065a in KIO::SlaveInterface::dispatch(int, QByteArray const&) (this=0x5635b6cd7ee0, _cmd=104, rawdata=...) at /usr/src/debug/kio/kio-5.105.0/src/core/slaveinterface.cpp:149
#19 0x00007fb3e4cffe8a in KIO::SlaveInterface::dispatch() (this=0x5635b6cd7ee0) at /usr/src/debug/kio/kio-5.105.0/src/core/slaveinterface.cpp:78
#20 0x00007fb3e4d0a7b2 in KIO::Slave::gotInput() (this=0x5635b6cd7ee0) at /usr/src/debug/kio/kio-5.105.0/src/core/slave.cpp:354
#21 0x00007fb3e30beb41 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffd59535430, r=<optimized out>, this=0x5635b922ece0, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#22 doActivate<false>(QObject*, int, void**) (sender=0x5635b99a5c00, signal_index=3, argv=0x7ffd59535430) at kernel/qobject.cpp:3923
#23 0x00007fb3e30b1c80 in QObject::event(QEvent*) (this=0x5635b99a5c00, e=0x5635b3582cd0) at kernel/qobject.cpp:1347
#24 0x00007fb3e3d78b5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x5635b99a5c00, e=0x5635b3582cd0) at kernel/qapplication.cpp:3640
#25 0x00007fb3e308e028 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x5635b99a5c00, event=0x5635b3582cd0) at kernel/qcoreapplication.cpp:1064
#26 0x00007fb3e308e093 in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#27 0x00007fb3e308eb33 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x5635b31ef100) at kernel/qcoreapplication.cpp:1821
#28 0x00007fb3e30d4f58 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x5635b32045b0) at kernel/qeventdispatcher_glib.cpp:277
#29 0x00007fb3e0f0f53b in g_main_dispatch (context=0x7fb3d8000ee0) at ../glib/glib/gmain.c:3460
#30 g_main_context_dispatch (context=0x7fb3d8000ee0) at ../glib/glib/gmain.c:4200
#31 0x00007fb3e0f6c219 in g_main_context_iterate.constprop.0 (context=0x7fb3d8000ee0, block=1, dispatch=1, self=<optimized out>) at ../glib/glib/gmain.c:4276
#32 0x00007fb3e0f0e1a2 in g_main_context_iteration (context=0x7fb3d8000ee0, may_block=1) at ../glib/glib/gmain.c:4343
#33 0x00007fb3e30d8d3c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5635b31c4940, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#34 0x00007fb3e308668c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7ffd595358b0, flags=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#35 0x00007fb3e30912f9 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#36 0x00007fb3e353b052 in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1870
#37 0x00007fb3e3d76f2a in QApplication::exec() () at kernel/qapplication.cpp:2832
#38 0x00005635b149ddab in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/dolphin/dolphin-23.04.0/src/main.cpp:249
[Inferior 1 (process 27126) detached]

Reported using DrKonqi
Comment 1 Patrick Silva 2023-11-16 22:10:05 UTC
Crash reproducible on neon unstable.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.81.0
KDE Frameworks Version: 5.245.0
Qt Version: 6.6.0
Graphics Platform: X11
Comment 2 Akseli Lahtinen 2023-11-17 08:23:14 UTC
Confirmed with following steps

1. Create files to empty directory with bash oneliner: `for i in {1..5142}; do dd if=/dev/urandom bs=1024 count=100 of=test-${i}.jpg; done`
1.1. Warning, that will create 500mb worth of fake jpg files
2. Select all with ctrl+a
3. Rename with f2
4. Allow renaming to finish
5. Press ctrl+z
6. Press ctrl+q when the renaming process starts again
7. Crash!

The files do not have to be jpg files, any files will do.

Full backtrace:

Application: Dolphin (dolphin), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = 0x0}
[KCrash Handler]
#5  0x00007f0b73604321 in QWidgetPrivate::windowHandle(QWidgetPrivate::WindowHandleMode) const () at /lib64/libQt6Widgets.so.6
#6  0x00007f0b7460d55b in KJobWidgets::setWindow(QObject*, QWidget*) (job=0x35c32b0, widget=0x2385840) at /home/akseli/Repositories/kde/src/kwidgetsaddons/src/kjobwidgets.cpp:17
#7  0x00007f0b75ef2699 in KIO::FileUndoManagerPrivate::undoStep() (this=0x2341260) at /home/akseli/Repositories/kde/src/kio/src/widgets/fileundomanager.cpp:521
#8  0x00007f0b75ef255c in KIO::FileUndoManagerPrivate::slotResult(KJob*) (this=0x2341260, job=0x4c74810) at /home/akseli/Repositories/kde/src/kio/src/widgets/fileundomanager.cpp:489
#9  0x00007f0b75efd3ba in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<KJob*>, void, void (KIO::FileUndoManagerPrivate::*)(KJob*)>::call(void (KIO::FileUndoManagerPrivate::*)(KJob*), KIO::FileUndoManagerPrivate*, void**) (f=(void (KIO::FileUndoManagerPrivate::*)(KIO::FileUndoManagerPrivate * const, KJob *)) 0x7f0b75ef20f6 <KIO::FileUndoManagerPrivate::slotResult(KJob*)>, o=0x2341260, arg=0x7ffd4dee1e30) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:145
#10 0x00007f0b75efbfb6 in QtPrivate::FunctionPointer<void (KIO::FileUndoManagerPrivate::*)(KJob*)>::call<QtPrivate::List<KJob*>, void>(void (KIO::FileUndoManagerPrivate::*)(KJob*), KIO::FileUndoManagerPrivate*, void**) (f=(void (KIO::FileUndoManagerPrivate::*)(KIO::FileUndoManagerPrivate * const, KJob *)) 0x7f0b75ef20f6 <KIO::FileUndoManagerPrivate::slotResult(KJob*)>, o=0x2341260, arg=0x7ffd4dee1e30) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:182
#11 0x00007f0b75efad33 in QtPrivate::QCallableObject<void (KIO::FileUndoManagerPrivate::*)(KJob*), QtPrivate::List<KJob*>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x540d980, r=0x2341260, a=0x7ffd4dee1e30, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:520
#12 0x00007f0b72402011 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt6Core.so.6
#13 0x00007f0b7434992a in KJob::result(KJob*, KJob::QPrivateSignal) (this=0x4c74810, _t1=0x4c74810, _t2=...) at /home/akseli/Repositories/kde/build/kcoreaddons/src/lib/KF6CoreAddons_autogen/include/moc_kjob.cpp:793
#14 0x00007f0b7434733f in KJob::finishJob(bool) (this=0x4c74810, emitResult=true) at /home/akseli/Repositories/kde/src/kcoreaddons/src/lib/jobs/kjob.cpp:98
#15 0x00007f0b74347f4b in KJob::emitResult() (this=0x4c74810) at /home/akseli/Repositories/kde/src/kcoreaddons/src/lib/jobs/kjob.cpp:329
#16 0x00007f0b75713ed9 in KIO::SimpleJob::slotFinished() (this=0x4c74810) at /home/akseli/Repositories/kde/src/kio/src/core/simplejob.cpp:229
#17 0x00007f0b75717645 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KIO::SimpleJob::*)()>::call(void (KIO::SimpleJob::*)(), KIO::SimpleJob*, void**) (f=&virtual KIO::SimpleJob::slotFinished(), o=0x4c74810, arg=0x7ffd4dee2098) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:145
#18 0x00007f0b757173ba in QtPrivate::FunctionPointer<void (KIO::SimpleJob::*)()>::call<QtPrivate::List<>, void>(void (KIO::SimpleJob::*)(), KIO::SimpleJob*, void**) (f=&virtual KIO::SimpleJob::slotFinished(), o=0x4c74810, arg=0x7ffd4dee2098) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:182
#19 0x00007f0b7571717b in QtPrivate::QCallableObject<void (KIO::SimpleJob::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x3b74d50, r=0x4c74810, a=0x7ffd4dee2098, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:520
#20 0x00007f0b72402011 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt6Core.so.6
#21 0x00007f0b757ce88d in KIO::WorkerInterface::finished() (this=0x38142d0) at /home/akseli/Repositories/kde/build/kio/src/core/KF6KIOCore_autogen/include/moc_workerinterface_p.cpp:639
#22 0x00007f0b757cc164 in KIO::WorkerInterface::dispatch(int, QByteArray const&) (this=0x38142d0, _cmd=104, rawdata=...) at /home/akseli/Repositories/kde/src/kio/src/core/workerinterface.cpp:129
#23 0x00007f0b757cbdfc in KIO::WorkerInterface::dispatch() (this=0x38142d0) at /home/akseli/Repositories/kde/src/kio/src/core/workerinterface.cpp:60
#24 0x00007f0b757c9cc1 in KIO::Worker::gotInput() (this=0x38142d0) at /home/akseli/Repositories/kde/src/kio/src/core/worker.cpp:263
#25 0x00007f0b757cba88 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KIO::Worker::*)()>::call(void (KIO::Worker::*)(), KIO::Worker*, void**) (f=(void (KIO::Worker::*)(KIO::Worker * const)) 0x7f0b757c9c7e <KIO::Worker::gotInput()>, o=0x38142d0, arg=0x7ffd4dee25c8) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:145
#26 0x00007f0b757cba0e in QtPrivate::FunctionPointer<void (KIO::Worker::*)()>::call<QtPrivate::List<>, void>(void (KIO::Worker::*)(), KIO::Worker*, void**) (f=(void (KIO::Worker::*)(KIO::Worker * const)) 0x7f0b757c9c7e <KIO::Worker::gotInput()>, o=0x38142d0, arg=0x7ffd4dee25c8) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:182
#27 0x00007f0b757cb94f in QtPrivate::QCallableObject<void (KIO::Worker::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x44a30f0, r=0x38142d0, a=0x7ffd4dee25c8, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:520
#28 0x00007f0b72402011 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt6Core.so.6
#29 0x00007f0b75655b21 in KIO::Connection::readyRead() (this=0x3c7add0) at /home/akseli/Repositories/kde/build/kio/src/core/KF6KIOCore_autogen/include/moc_connection_p.cpp:160
#30 0x00007f0b75654c59 in KIO::ConnectionPrivate::dequeue() (this=0x298ac70) at /home/akseli/Repositories/kde/src/kio/src/core/connection.cpp:31
#31 0x00007f0b75654c79 in operator()() const (__closure=0x3fa5cc0) at /home/akseli/Repositories/kde/src/kio/src/core/connection.cpp:40
#32 0x00007f0b75656516 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, KIO::ConnectionPrivate::commandReceived(const KIO::Task&)::<lambda()> >::call(struct {...} &, void **) (f=..., arg=0x26aadb8) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:137
#33 0x00007f0b75656417 in QtPrivate::Functor<KIO::ConnectionPrivate::commandReceived(const KIO::Task&)::<lambda()>, 0>::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x26aadb8) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:339
#34 0x00007f0b75656148 in QtPrivate::QCallableObject<KIO::ConnectionPrivate::commandReceived(const KIO::Task&)::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x3fa5cb0, r=0x3c7add0, a=0x26aadb8, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:522
#35 0x00007f0b723f3617 in QObject::event(QEvent*) () at /lib64/libQt6Core.so.6
#36 0x00007f0b735c2b38 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6
#37 0x00007f0b723a0ba8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt6Core.so.6
#38 0x00007f0b723a4aa5 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /lib64/libQt6Core.so.6
#39 0x00007f0b726410bf in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () at /lib64/libQt6Core.so.6
#40 0x00007f0b70b7be5c in g_main_context_dispatch_unlocked.lto_priv () at /lib64/libglib-2.0.so.0
#41 0x00007f0b70bd6dd8 in g_main_context_iterate_unlocked.isra () at /lib64/libglib-2.0.so.0
#42 0x00007f0b70b79ad3 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#43 0x00007f0b7264096f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Core.so.6
#44 0x00007f0b723ad9bb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Core.so.6
#45 0x00007f0b723a97bd in QCoreApplication::exec() () at /lib64/libQt6Core.so.6
#46 0x0000000000440738 in main(int, char**) (argc=1, argv=0x7ffd4dee4128) at /home/akseli/Repositories/kde/src/dolphin/src/main.cpp:255
[Inferior 1 (process 103956) detached]
Comment 3 Akseli Lahtinen 2023-11-17 08:26:43 UTC
Forgot to mention...

Dolphin:
Using kdesrc-build dolphin version: 24.01.75

System info:
Operating System: Fedora Linux 39
KDE Plasma Version: 5.81.0
KDE Frameworks Version: 5.245.0
Qt Version: 6.6.0
Kernel Version: 6.5.11-300.fc39.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Comment 4 Bug Janitor Service 2023-12-08 08:44:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1504
Comment 5 Akseli Lahtinen 2023-12-08 12:25:23 UTC
Git commit d807cbe0a7fb02ff6bda4f7be066c1323423743f by Akseli Lahtinen.
Committed on 08/12/2023 at 13:25.
Pushed by akselmo into branch 'master'.

Fix crash if window is closed when undoing

If dolphin is closed when undoing something,
this will crash. Set parentWidget as QPointer
to avoid crashing: Instead, the undo process
gets cancelled gracefully.

M  +1    -1    src/widgets/fileundomanager.cpp

https://invent.kde.org/frameworks/kio/-/commit/d807cbe0a7fb02ff6bda4f7be066c1323423743f