Bug 412661

Summary: Copy paste error in KIO::TransferJob::doResume()
Product: [Frameworks and Libraries] frameworks-kio Reporter: wolthera <griffinvalley>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED NOT A BUG    
Severity: normal CC: a.samirh78, kdelibs-bugs
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description wolthera 2019-10-06 11:17:55 UTC
Hey,

I was looking at the KIO job files because I was trying to understand how KJob::doResume() should be implemented, and noticed the following in the transferjob file:

291 bool TransferJob::doResume()
292 {
293     Q_D(TransferJob);
294     if (!SimpleJob::doResume()) {
295         return false;
296     }
297     if (d->m_internalSuspended) {
298         d->internalSuspend();
299     }
300     return true;
301 }

The function seems to call d->internalSuspend() on line 298 instead of d->internalResume(), which seems wrong to me?

I am looking at the file here: https://api.kde.org/frameworks-api/frameworks-apidocs/frameworks/kio/html/transferjob_8cpp_source.html
Comment 1 wolthera 2019-10-06 11:26:17 UTC
I might be wrong btw, I am not too familiar with the code, just confused that resume suspends a thing but never resumes...
Comment 2 Ahmad Samir 2019-10-07 10:00:50 UTC
There are two different objects here, a KIO job and KIO slave; the actual job resume is done in SimpleJob::doResume() and if that succeeds, d->internalSuspend() suspends the KIO slave (not the job):
void TransferJobPrivate::internalSuspend()
{
    m_internalSuspended = true;
    if (m_slave) {
        m_slave->suspend();
    }
}
Comment 3 wolthera 2019-10-07 12:56:36 UTC
Alright, thanks!