From 7c2767ef3b575bc4b27d4d57ab9f2d5d1acbd3ce Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 22 Aug 2019 11:52:41 -0400 Subject: cmCTestMultiProcessHandler: Explain testRun ownership in comments The ownership semantics of the 'testRun' variable are subtle and may fool static analysers. Add comments explaining them for now. Later some refactoring could be done to clarify the code. Issue: #19610 --- Source/CTest/cmCTestMultiProcessHandler.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 2d07420..21d5595 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -189,10 +189,13 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) std::strerror(workdir.GetLastResult())); } else { if (testRun->StartTest(this->Completed, this->Total)) { + // Ownership of 'testRun' has moved to another structure. + // When the test finishes, FinishTestProcess will be called. return true; } } + // Pass ownership of 'testRun'. this->FinishTestProcess(testRun, false); return false; } -- cgit v0.12