瀏覽代碼

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
Brad King 6 年之前
父節點
當前提交
7c2767ef3b
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Source/CTest/cmCTestMultiProcessHandler.cxx

+ 3 - 0
Source/CTest/cmCTestMultiProcessHandler.cxx

@@ -189,10 +189,13 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test)
                           std::strerror(workdir.GetLastResult()));
                           std::strerror(workdir.GetLastResult()));
   } else {
   } else {
     if (testRun->StartTest(this->Completed, this->Total)) {
     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;
       return true;
     }
     }
   }
   }
 
 
+  // Pass ownership of 'testRun'.
   this->FinishTestProcess(testRun, false);
   this->FinishTestProcess(testRun, false);
   return false;
   return false;
 }
 }