Kill CTestFindJob when its project is destroyed

When a user closes a project while its associated CTestFindJob is still
working, the job is not notified and keeps running. After that, when
BackgroundParser eventually parses all documents requested by the job,
the job calls TestController::addTestSuite(). Inside this call the
CTestSuite::project() pointer is dereferenced in
TestView::addTestSuite() => TestView::itemForProject(), which causes a
segmentation fault.

Ideally all associated CTestFindJob-s should be killed just before or
just after a project is closed to revert their no longer useful requests
to BackgroundParser as soon as possible. However, reliably detecting
that the project is no longer open is not straightforward, especially if
the project opening is aborted or the project is closed even before a
CTestFindJob is created. My implementation of such a proper fix is
intertwined with several other CTest-, TestController- and
TestView-related fixes. The combined fix will be so large that it won't
fit into the 5.6 branch. So this commit implements a simple temporary
workaround for the fairly easy to trigger crash: check if the project is
destroyed in CTestFindJob::updateReady() and kill the job if this is the

BUG: 329246
FIXED-IN: 5.6.1
1 job for !174 with fix-ctestfindjob-crashes in 60 minutes and 12 seconds (queued for 156 minutes and 20 seconds)
Status Job ID Name Coverage
failed #71421
linux kf5-qt5 qt5.12


Name Stage Failure
linux kf5-qt5 qt5.12 Build The script exceeded the maximum execution time set for the job
TOTAL 141736 64557 45%
Uploading artifacts for successful job
Uploading artifacts...
build: found 16332 matching files and directories

WARNING: Uploading artifacts as "archive" to coordinator... failed id=71421 responseStatus=502 Bad Gateway status=502 token=zFwpTCm-
WARNING: Retrying... context=artifacts-uploader error=invalid argument
ERROR: Job failed: execution took longer than 1h0m0s seconds