Comment 240 for bug 1512120

Created attachment 6976
Fix crash and hang while renaming

A new version of my patch. This fixes both:
- the crash when renaming a file through the popup dialog
- the hang when renaming many files at once (e.g. using mv)

For the remaining crashes (while using mv command), please apply