Bug 318757 - Cancelling file overwrite dialog modifies clipboard contents
Summary: Cancelling file overwrite dialog modifies clipboard contents
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Unmaintained
Component: general (show other bugs)
Version: 4.10.2
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-23 10:47 UTC by Christoph Feck
Modified: 2013-08-05 11:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.11
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Feck 2013-04-23 10:47:18 UTC
To reproduce:
- make two folders A and B both containing a "file.txt" file
- in folder A, mark "file.txt" and select "Cut" from context menu
- go to folder B, and select "Paste" from context menu
- the file overwrite dialog appears, cancel it
- select "Paste" again

Expected results:
- the file overwrite dialog appears again

Actual results:
- a different message appears indicating a different file would be moved
- the original path "A/file.txt" is no longer in clipboard, but "B/file.txt" is

Tested with today's git/master.
Comment 1 Frank Reininghaus 2013-04-23 11:02:22 UTC
Thanks for the report. I believe that the bug is in

static KIO::Job *pasteClipboardUrls(const QMimeData* mimeData, const KUrl& destDir, KIO::JobFlags flags = KIO::DefaultFlags)

in kdelibs/kio/kio/paste.cpp. It updates the clipboard just after starting the job, when it's not known yet if pasting succeeds or not.

http://code.woboq.org/kde/kdelibs/kio/kio/paste.cpp.html#_ZL18pasteClipboardUrlsPK9QMimeDataRK4KUrl6QFlagsIN3KIO7JobFlagEE
Comment 2 Dawit Alemayehu 2013-07-21 18:31:58 UTC
Git commit e4b786f6df87aba226931082e5ad2791ac529978 by Dawit Alemayehu.
Committed on 18/07/2013 at 06:11.
Pushed by adawit into branch 'KDE/4.11'.

Don't update clipboard before cut/paste operation succeedes.
FIXED-IN: 4.11
REVIEW: 111585

M  +1    -0    kio/CMakeLists.txt
A  +107  -0    kio/kio/clipboardupdater.cpp     [License: LGPL (v2+)]
A  +64   -0    kio/kio/clipboardupdater_p.h     [License: LGPL (v2+)]
M  +2    -0    kio/kio/fileundomanager.cpp
M  +2    -12   kio/kio/paste.cpp
M  +38   -1    kio/tests/fileundomanagertest.cpp
M  +1    -0    kio/tests/fileundomanagertest.h

http://commits.kde.org/kdelibs/e4b786f6df87aba226931082e5ad2791ac529978
Comment 3 Dawit Alemayehu 2013-08-02 12:37:23 UTC
Git commit 2f19231bc9f32f2642df9556af81ce339307b091 by Dawit Alemayehu.
Committed on 29/07/2013 at 02:28.
Pushed by adawit into branch 'KDE/4.11'.

Update URLs copied to clipboard if they change as a result of KIO operations.
Related: bug 134960
FIXED-IN: 4.11
REVIEW: 111776

M  +84   -12   kio/kio/clipboardupdater.cpp
M  +15   -3    kio/kio/clipboardupdater_p.h
M  +10   -3    kio/kio/copyjob.cpp
M  +7    -2    kio/kio/deletejob.cpp
M  +8    -2    kio/kio/job.cpp
M  +5    -6    kio/kio/paste.cpp
M  +1    -0    kio/tests/CMakeLists.txt
A  +168  -0    kio/tests/clipboardupdatertest.cpp     [License: LGPL (v2+)]
A  +37   -0    kio/tests/clipboardupdatertest.h     [License: LGPL (v2+)]
M  +8    -8    kio/tests/fileundomanagertest.cpp
M  +1    -1    kio/tests/fileundomanagertest.h

http://commits.kde.org/kdelibs/2f19231bc9f32f2642df9556af81ce339307b091
Comment 4 Dawit Alemayehu 2013-08-02 13:57:36 UTC
Git commit 2f5218463d1b7b7fc6eb17feee1195deacda1577 by Dawit Alemayehu.
Committed on 02/08/2013 at 13:47.
Pushed by adawit into branch 'KDE/4.11'.

Updates last commit with minor and cosmetic changes.

REVIEW: 111776
Related: bug 134960

M  +10   -12   kio/kio/clipboardupdater.cpp
M  +4    -0    kio/kio/clipboardupdater_p.h
M  +3    -3    kio/tests/clipboardupdatertest.cpp

http://commits.kde.org/kdelibs/2f5218463d1b7b7fc6eb17feee1195deacda1577
Comment 5 Dawit Alemayehu 2013-08-05 11:53:42 UTC
Git commit 9b0b5ec1a6396b051f65bf23cdf9d9949aa9c3ec by Dawit Alemayehu.
Committed on 05/08/2013 at 06:23.
Pushed by adawit into branch 'KDE/4.11'.

Fix unintended runtime dependency introduced when fixing #134960.

REVIEW: 111776
Related: bug 134960

M  +26   -7    kio/kio/clipboardupdater.cpp
M  +7    -1    kio/kio/clipboardupdater_p.h
M  +3    -3    kio/kio/copyjob.cpp
M  +2    -2    kio/kio/deletejob.cpp
M  +1    -1    kio/kio/fileundomanager.cpp
M  +2    -2    kio/kio/job.cpp
M  +3    -2    kio/kio/paste.cpp

http://commits.kde.org/kdelibs/9b0b5ec1a6396b051f65bf23cdf9d9949aa9c3ec