Bug 392743

Summary: Crash when renaming (not using inline rename)
Product: [Applications] dolphin Reporter: Christoph Feck <cfeck>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: chinmoyrp65, elvis.angelaccio, scott
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 18.03.90
Sentry Crash Report:

Description Christoph Feck 2018-04-04 23:42:08 UTC
Steps to reproduce:
- Dolphin compiled from master 2018-04-01
- Configure Dolphin > General > disable Rename inline
- Select a file, press F2, type a new name and Enter

Crash:
Thread 1 "dolphin" received signal SIGSEGV, Segmentation fault.
0x00007ffff2b7c900 in QSpinBox::value() const () from /usr/lib64/libQt5Widgets.so.5
(gdb) bt
#0  0x00007ffff2b7c900 in QSpinBox::value() const () from /usr/lib64/libQt5Widgets.so.5
#1  0x00007ffff74e67ee in RenameDialog::slotAccepted() () from /usr/lib64/libdolphinprivate.so.5
#2  0x00007ffff1a1296c in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#3  0x00007ffff2b6e310 in QDialogButtonBoxPrivate::_q_handleButtonClicked() () from /usr/lib64/libQt5Widgets.so.5
#4  0x00007ffff1a1286a in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#5  0x00007ffff2ad31b2 in QAbstractButton::clicked(bool) () from /usr/lib64/libQt5Widgets.so.5
#6  0x00007ffff2ad339a in QAbstractButtonPrivate::emitClicked() () from /usr/lib64/libQt5Widgets.so.5
#7  0x00007ffff2ad4003 in QAbstractButton::click() () from /usr/lib64/libQt5Widgets.so.5
#8  0x00007ffff2bc171c in QDialog::keyPressEvent(QKeyEvent*) () from /usr/lib64/libQt5Widgets.so.5
#9  0x00007ffff2a24bf7 in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#10 0x00007ffff29e800c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#11 0x00007ffff29f0842 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#12 0x00007ffff19e4648 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#13 0x00007ffff2a40dec in QWidgetWindow::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#14 0x00007ffff29e800c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#15 0x00007ffff29ef304 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#16 0x00007ffff19e4648 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#17 0x00007ffff21e6a58 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib64/libQt5Gui.so.5
#18 0x00007ffff21eb735 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) ()
   from /usr/lib64/libQt5Gui.so.5
#19 0x00007ffff21c44fb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib64/libQt5Gui.so.5
#20 0x00007fffe3b5e15b in QPAEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5XcbQpa.so.5
#21 0x00007ffff19e2e4a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#22 0x00007ffff19eba94 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#23 0x00007ffff7b43337 in kdemain () from /usr/lib64/libkdeinit5_dolphin.so
#24 0x00007ffff7760a87 in __libc_start_main () from /lib64/libc.so.6
#25 0x000055555555481a in _start ()
Comment 1 Christoph Feck 2018-04-04 23:43:57 UTC
This might be a bug in 18.04 branch, too.
Comment 2 Christoph Feck 2018-04-05 12:35:42 UTC
Well, there is no QSpinBox in the simple rename dialog. The new code probably was written with the more complex rename dialog in mind.
Comment 3 Christoph Feck 2018-04-05 12:46:44 UTC
https://cgit.kde.org/dolphin.git/commit/src/views?id=c5eb4e31161ccf422a2f2492fe998c5c9817bea4 removed the code for the simple rename KIO::moveAs call, but instead always uses KIO::batchRename. Only the undo logic checks for the simple rename.

For the simple rename, KIO::batchRename cannot be used, because it always tries to either replace or append the running index number.
Comment 4 Elvis Angelaccio 2018-04-05 21:28:05 UTC
Git commit 30349ef1bdcae0ed80f47c168d46c15020b927d3 by Elvis Angelaccio.
Committed on 05/04/2018 at 21:15.
Pushed by elvisangelaccio into branch 'Applications/18.04'.

[RenameDialog] Fix crash when renaming single items

Summary:
`m_spinBox` is initialized only when renaming multiple items.

This commit restores the single-item rename logic which was wrongly
removed by commit c5eb4e31161ccf422.
FIXED-IN: 18.03.90

Test Plan: Disable inline renaming and try to rename single or multiple items (and also to undo the jobs).

Subscribers: #dolphin

Differential Revision: https://phabricator.kde.org/D11972

M  +11   -4    src/views/renamedialog.cpp

https://commits.kde.org/dolphin/30349ef1bdcae0ed80f47c168d46c15020b927d3
Comment 5 Scott Harvey 2018-04-05 21:45:38 UTC
Beat me to it. I was going to attempt this, but I doubt I could have done it as quickly as Elvis did. At least I know my idea was roughly correct.