Diffusion KIO 3f3c6d30b739

Fix crash while moving files

Authored by hallas on Feb 21 2019, 8:42 PM.

Description

Fix crash while moving files

Summary:
The crash happens when the following sequence of events occurs:

  1. A FileCopyJob is created and added as a SubJob to CopyJob
  2. CopyJob::slotResult is notified
  3. CopyJobPrivate::slotResultCopyingFiles is called because it is in state STATE_COPYING_FILES
  4. CopyJobPrivate::slotResultErrorCopyingFiles is called bcause the FileCopyJob is reporting an error
  5. uiDelegateExtension()->askSkip is called to ask the user how to handle the error
  6. The askSkip function starts a modal QDialog and calls exec, this means a new QEventLoop is started and runs.
  7. Before the askSkip function returns, CopyJob::slotResult is notified again because a new error occurs on the same FileCopyJob
  8. CopyJobPrivate::slotResultCopyingFiles is called because it is in state STATE_COPYING_FILES
  9. CopyJobPrivate::slotResultErrorCopyingFiles is called bcause the FileCopyJob is reporting an error
  10. uiDelegateExtension()->askSkip is called to ask the user how to handle the error
  11. The user responds and the job is cancelled
  12. Finally the initial call to askSkip returns but we are now in an inconsistent state because the job that was notified has been deleted

To avoid getting notifications for a job while waiting for user feedback simply remove it using removeSubJob prior to calling askSkip.

Test Plan:

  • Move a directory with a bunch of files to a NTFS USB Drive
  • While it is moving the files, move them back
  • Sometimes I have to have more then one move back and forth running for it to crash

Reviewers: Frameworks, elvisangelaccio, dfaure

Reviewed By: dfaure

Subscribers: cfeck, dhaumann, kde-frameworks-devel

Tags: Frameworks

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

Details

Committed
hallasMar 3 2019, 1:22 PM
Reviewer
dfaure
Differential Revision
D19170: Fix crash while moving files
Parents
R241:01a7e0e757d3: Fix NTFS hidden check for symlinks to NTFS mountpoints
Branches
Unknown
Tags
Unknown