mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-30 02:31:40 +00:00
Reduce pipeline use-after-free errors (#1447)
This commit is contained in:
@@ -101,13 +101,17 @@ public class VisionRunner {
|
||||
continue;
|
||||
}
|
||||
|
||||
// There's no guarantee the processing type change will occur this tick, so pipelines should
|
||||
// check themselves
|
||||
try {
|
||||
var pipelineResult = pipeline.run(frame, cameraQuirks);
|
||||
pipelineResultConsumer.accept(pipelineResult);
|
||||
} catch (Exception ex) {
|
||||
logger.error("Exception on loop " + loopCount, ex);
|
||||
// If the pipeline has changed while we are getting our frame we should scrap that frame it
|
||||
// may result in incorrect frame settings like hsv values
|
||||
if (pipeline == pipelineSupplier.get()) {
|
||||
// There's no guarantee the processing type change will occur this tick, so pipelines should
|
||||
// check themselves
|
||||
try {
|
||||
var pipelineResult = pipeline.run(frame, cameraQuirks);
|
||||
pipelineResultConsumer.accept(pipelineResult);
|
||||
} catch (Exception ex) {
|
||||
logger.error("Exception on loop " + loopCount, ex);
|
||||
}
|
||||
}
|
||||
|
||||
loopCount++;
|
||||
|
||||
Reference in New Issue
Block a user