The crash was introduced with the commit 951cb9c35d7a9ef814b3de5b359915968da9b881
Author: Frank Reininghaus <email@example.com>
Date: Mon Nov 5 22:03:52 2012 +0100
Prevent crashes caused by nested event loops run when renaming inline
When renaming inline and starting a drag or invoking the context menu,
a nested event loop will be run. If the role editor loses focus and
emits roleEditingFinished(), we must prevent that deleteLater() is
called because this would delete the role editor inside a nested event
loop which is run from one of its own functions. We would get a crash
when returning from that event loop otherwise.
Steps to Reproduce:
1. Use inline-renaming instead of rename-dialog
2. Select a file
3. Start renaming
4. Accept changes with RETURN key.
Crash -> File not renamed
Don't Crash -> Rename the file
It works fine when you accept the changes with focus losing (click with the mouse outside the inline-renaming box) => It only crashes with RETURN key
A have already tried to fix that with Locking (QMutex, QMutexLocker), but that didn't work.
An "ugly" but working fix is, when we replace the line emitRoleEditingFinished(); (kitemlistroleeditor.cpp line 147) with clearFocus();
=> So the event KItemListRoleEditor::event(QEvent* event) is only called once instead of two times, when you press the return key.
Thanks Emmanuel! This was actually a rather tricky issue that I spent a lot
of time on, but nonetheless,I forgot to test this trivial use case. This
shows that I should have my own commits reviewed as well, at least the
Using a mutex won't help because it's all in the same thread.
I'm not sure when I'll have the time to look into this. If the clearFocus
hack works, feel free to commit that and add a TODO comment that we should
look for a better long-term solution.
Thanks again for investigating the mess that I caused!
Git commit 3143acc084d54d43df469b54762bfa10a7050a9f by Emmanuel Pescosta.
Committed on 09/11/2012 at 12:10.
Pushed by emmanuelp into branch 'KDE/4.9'.
Fix Bug 309760 - Crash while inline-renaming a file and apply change with return-key
M +2 -1 dolphin/src/kitemviews/private/kitemlistroleeditor.cpp