From e9bc9c47c2617d56a7cf3b3be0a962b363c884e5 Mon Sep 17 00:00:00 2001 From: Ehren Metcalfe Date: Sat, 31 May 2014 19:41:16 -0400 Subject: [PATCH] Fix resource leak with iOS camera due to failure to remove AVCaptureSession input/outputs on stop (Bug #3389) Conflicts: modules/highgui/src/cap_ios_abstract_camera.mm --- modules/videoio/src/cap_ios_abstract_camera.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/videoio/src/cap_ios_abstract_camera.mm b/modules/videoio/src/cap_ios_abstract_camera.mm index 1ded46a99f..565807cccc 100644 --- a/modules/videoio/src/cap_ios_abstract_camera.mm +++ b/modules/videoio/src/cap_ios_abstract_camera.mm @@ -193,6 +193,13 @@ // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; + for (AVCaptureInput *input in self.captureSession.inputs) { + [self.captureSession removeInput:input]; + } + + for (AVCaptureOutput *output in self.captureSession.outputs) { + [self.captureSession removeOutput:output]; + } [self.captureSession stopRunning]; self.captureSession = nil;