Skip to content

Commit cd7d8ff

Browse files
committed
Detailed comment to justify cleaning up output delegate
1 parent b2f9089 commit cd7d8ff

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

package/ios/Core/CameraSession+Configuration.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ extension CameraSession {
6161

6262
// Remove all outputs
6363
for output in captureSession.outputs {
64+
// The following delegates are weak references
65+
// so cleaning them up is not strictly necessary
66+
// from a safety standpoint.
67+
// It is good to mark that between this point
68+
// and logic further down configureOutput()
69+
// messages to delegate would be in an undefined
70+
// state and in with delegate == self the weak
71+
// references wouldn't be cleared during that
72+
// window.
6473
if let metadataOutput = output as? AVCaptureMetadataOutput {
6574
metadataOutput.setMetadataObjectsDelegate(nil, queue: nil)
6675
}

0 commit comments

Comments
 (0)