<table><tr><td style="">hallas edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-lxritipsxk2fm5q/">(Show Details)</a><br />hallas edited the test plan for this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-qp7sfgcpwx4qmnn/">(Show Details)</a>
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D19170">View Revision</a></tr></table><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Fix crash while moving files.</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">The crash happens when the following sequence of events occurs:<br />
<br />
 # A FileCopyJob is created and added as a SubJob to CopyJob<br />
 # CopyJob::slotResult is notified<br />
 # CopyJobPrivate::slotResultCopyingFiles is called because it is in state STATE_COPYING_FILES<br />
 # CopyJobPrivate::slotResultErrorCopyingFiles is called bcause the FileCopyJob is reporting an error<br />
 # uiDelegateExtension()->askSkip is called to ask the user how to handle the error<br />
 # The askSkip function starts a modal QDialog and calls exec, this means a new QEventLoop is started and runs.<br />
 # Before the askSkip function returns, CopyJob::slotResult is notified again because a new error occurs on the same FileCopyJob<br />
 # CopyJobPrivate::slotResultCopyingFiles is called because it is in state STATE_COPYING_FILES<br />
</span> <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">The backtrace points towards</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"># CopyJobPrivate::slotResultErrorCopyingFiles is called bcause</span> the <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">KJob</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">FileCopyJob is reporting an error</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">being deleted after emitting</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"> # uiDelegateExtension()->askSkip is called to ask</span> the <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">result signal causing</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">user how to handle</span> the <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">subsequent</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">error</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">call to isAutoDelete to crash.</span> <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Instead simply call isAutoDelete and</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"># The user responds and the job is cancelled</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">potentially deleteLater prior to emitting the result signal.</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"> # Finally the initial call to askSkip returns but we are now in an inconsistent state because the job that was notified has been deleted</span><br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">BUG: 368287</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">To avoid getting notifications for a job while waiting for user feedback simply remove it using removeSubJob prior to calling askSkip.</span></div></div></div><br /><div><strong>CHANGES TO TEST PLAN</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">I haven't been able to reproduce the issue so this commit should be</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">* Move a directory with a bunch of files to a NTFS USB Drive<br />
* While it is moving the files, move them back</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">seen as a test commit to verify if this is indeed the root cause.</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">* Sometimes I have to have more then one move back and forth running for it to crash</span></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D19170">https://phabricator.kde.org/D19170</a></div></div><br /><div><strong>To: </strong>hallas, Frameworks, elvisangelaccio, dfaure<br /><strong>Cc: </strong>dhaumann, kde-frameworks-devel, michaelh, ngraham, bruns<br /></div>