D19170: Fix crash while moving files

David Hallas noreply at phabricator.kde.org
Thu Feb 21 20:46:35 GMT 2019


hallas added a comment.


  I think I have finally found the root cause of this. The following 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
  
  So to avoid getting notifications for the same Job while waiting for user feedback I have tried to simply call removeSubJob prior to calling askSkip, since that function disconnects from the result signal. Also removeSubJob will anyway be call after the user has responded. This also means that the problem is in KIO::CopyJob and not i KJob.

REPOSITORY
  R244 KCoreAddons

REVISION DETAIL
  https://phabricator.kde.org/D19170

To: hallas, #frameworks, elvisangelaccio, dfaure
Cc: dhaumann, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190221/b503ebb3/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list