Skip to content

Commit

Permalink
Reduce pipeline use-after-free errors (#1447)
Browse files Browse the repository at this point in the history
  • Loading branch information
Juniormunk authored Oct 7, 2024
1 parent cd9dd07 commit c4b273e
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,17 @@ private void update() {
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++;
Expand Down

0 comments on commit c4b273e

Please sign in to comment.