Skip to content

Commit d73117f

Browse files
authored
[camera_avfoundation] Fixes sendability mismatch in completion handler (#13298)
This wasn't showing up in CI due to flutter/flutter#194517. Fixes flutter/flutter#194599 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent f8262d2 commit d73117f

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎packages/camera/camera_avfoundation/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.11.0+4
2+
3+
* Fixes a Swift 6 Sendability mismatch in the `CaptureDevice` protocol's `setExposureTargetBias` completion handler.
4+
15
## 0.11.0+3
26

37
* Fixes a crash when switching camera while recording video due to disconnected photo output.

‎packages/camera/camera_avfoundation/darwin/Tests/Mocks/MockCaptureDevice.swift‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MockCaptureDevice: NSObject, CaptureDevice {
1818
var setFocusPointOfInterestStub: ((CGPoint) -> Void)?
1919
var setExposureModeStub: ((AVCaptureDevice.ExposureMode) -> Void)?
2020
var setExposurePointOfInterestStub: ((CGPoint) -> Void)?
21-
var setExposureTargetBiasStub: ((Float, ((CMTime) -> Void)?) -> Void)?
21+
var setExposureTargetBiasStub: ((Float, (@Sendable (CMTime) -> Void)?) -> Void)?
2222
var isExposureModeSupportedStub: ((AVCaptureDevice.ExposureMode) -> Bool)?
2323
var setVideoZoomFactorStub: ((CGFloat) -> Void)?
2424
var lockForConfigurationStub: (() throws -> Void)?
@@ -99,7 +99,9 @@ class MockCaptureDevice: NSObject, CaptureDevice {
9999
set { setExposurePointOfInterestStub?(newValue) }
100100
}
101101

102-
func setExposureTargetBias(_ bias: Float, completionHandler handler: ((CMTime) -> Void)? = nil) {
102+
func setExposureTargetBias(
103+
_ bias: Float, completionHandler handler: (@Sendable (CMTime) -> Void)? = nil
104+
) {
103105
setExposureTargetBiasStub?(bias, handler)
104106
}
105107

‎packages/camera/camera_avfoundation/darwin/camera_avfoundation/Sources/camera_avfoundation/CaptureDevice.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protocol CaptureDevice: NSObjectProtocol {
4545
var minExposureTargetBias: Float { get }
4646
var maxExposureTargetBias: Float { get }
4747
func setExposureTargetBias(
48-
_ bias: Float, completionHandler handler: ((CMTime) -> Void)?)
48+
_ bias: Float, completionHandler handler: (@Sendable (CMTime) -> Void)?)
4949
func isExposureModeSupported(_ mode: AVCaptureDevice.ExposureMode) -> Bool
5050

5151
// Zoom

‎packages/camera/camera_avfoundation/pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera_avfoundation
22
description: iOS implementation of the camera plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_avfoundation
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.11.0+3
5+
version: 0.11.0+4
66

77
environment:
88
sdk: ^3.11.0

0 commit comments

Comments
 (0)