MCPcopy Create free account
hub / github.com/KDE/kdevelop / doKill

Method doKill

kdevplatform/util/kdevcoreaddons/ksequentialcompoundjob.cpp:147–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147bool KSequentialCompoundJob::doKill()
148{
149 Q_D(KSequentialCompoundJob);
150 // Don't check isFinished() here, because KJob::kill() calls doKill() only if the job has not finished.
151 if (d->m_killingSubjob) {
152 qCDebug(UTIL) << "killing sequential compound job recursively fails";
153 return false;
154 }
155 if (d->m_jobIndex == -1) {
156 qCDebug(UTIL) << "killing unstarted sequential compound job";
157 // Any unstarted subjobs will be deleted along with this compound job, which is their parent.
158 return true;
159 }
160 if (d->m_subjobs.empty()) {
161 qCDebug(UTIL) << "killing sequential compound job with zero remaining subjobs";
162 return true;
163 }
164
165 auto *const job = d->m_subjobs.front();
166 qCDebug(UTIL) << "killing running subjob" << job;
167
168 d->m_killingSubjob = true;
169 const bool killed = job->kill();
170 d->m_killingSubjob = false;
171
172 d->m_killingFailed = !killed;
173 if (d->m_killingFailed) {
174 qCDebug(UTIL) << "failed to kill subjob" << job;
175 if (d->m_subjobs.empty() || d->m_subjobs.constFirst() != job) {
176 qCDebug(UTIL) << "... but the subjob finished or was removed, assume killed. Remaining subjobs:" << d->m_subjobs;
177 return true;
178 }
179 }
180
181 return killed;
182}
183
184#include "moc_ksequentialcompoundjob.cpp"
185#include "moc_ksimplesequentialcompoundjob.cpp"

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.80
killMethod · 0.45

Tested by

no test coverage detected