DVCS crashes and KJob (bug 172309)

Evgeniy Ivanov powerfox at kde.ru
Sat Oct 11 13:15:46 UTC 2008

Hi all,
I've found the following thing in KJob and I think it is causing most
part of our DVCS crashes:
Look, start() is implemented in DVCSjob and it can emit result() (or
connect KProcess to slots emitting it). But it can emit result() before
loop will be execed and there will be no signals to stop it (deadlock or
crash depending on deferred deletion).
I have committed DVCS tests (vcs/dvcs/tests) which prove something
really wrong with deferred deletion, see dvcsjobTest.cpp:
First I have a deadlock in first job->exec(). I debugged and saw DVCSjob
emitted result() before loop is execed. QProcess::waitForStarted()
before starting a process fixed it.
Then I added another exec for the same job. Depending on
"job->setAutoDelete(false)" from the dvcsjobTest.cpp, tests got crash or
I think the reason is really in KJob::exec(). IMHO we should connect
result() to KJob::takeResult(){resultIsGot = true;} and do loop.exec()
only if resultIsGot == false. #qt confirms it.
But I don't understand how deleteLater kills an application. gdb shows
we stay in loop.exec() from KJob, so we do not return to the main loop
to activate deletion, right?

Cheers, Evgeniy.
Key fingerprint: F316 B5A1 F6D2 054F CD18 B74A 9540 0ABB 1FE5 67A3

More information about the KDevelop-devel mailing list