Commits

Peter Hosey committed a1e7843

Avert a retain cycle. Thanks to Colin Barrett (@cbarrett) and Kevin Ballard (@eridius) for reminding me of this on Twitter.

https://twitter.com/cbarrett/status/124995725867229184
https://twitter.com/eridius/status/124995751255343104

Comments (0)

Files changed (1)

 	}
 
 	__block PRHTask *bself = self;
+	pid_t launchedPID = pid; //Avert the retain cycle we'd have if the block accessed the ivar.
 
 	processExitSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_PROC, pid, DISPATCH_PROC_EXIT, defaultQueue);
 	dispatch_source_set_event_handler(processExitSource, ^(void) {
 		int status = -1;
-		waitpid(pid, &status, /*options*/ 0);
+		waitpid(launchedPID, &status, /*options*/ 0);
 		PRHTerminationBlock block = (WEXITSTATUS(status) == 0)
 			? [bself successfulTerminationBlock]
 			: [bself abnormalTerminationBlock];