Skip to content

Commit

Permalink
Merge pull request #21053 from wordpress-mobile/weak-delegate-violati…
Browse files Browse the repository at this point in the history
…on-fixes-3

Change scanningDelegate to a weak reference
  • Loading branch information
crazytonyli authored Jul 18, 2023
2 parents daac1a0 + f210ed6 commit 00c97fd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class QRLoginCameraSession: NSObject, QRCodeScanningSession {
return AVCaptureVideoPreviewLayer(session: session)
}

var scanningDelegate: QRCodeScanningDelegate?
weak var scanningDelegate: QRCodeScanningDelegate?

func configure() {
configureCamera()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protocol QRCameraPermissionsHandler: CameraPermissionsHandler {
}

/// A delegate that handles when a code was scanned and whether its valid or not
protocol QRCodeScanningDelegate {
protocol QRCodeScanningDelegate: AnyObject {
func validLink(_ stringValue: String) -> Bool
func didScanURLString(_ urlString: String)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import UniformTypeIdentifiers


@objc open class RichTextView: UIView, UITextViewDelegate {
@objc open var dataSource: RichTextViewDataSource?
@objc open var delegate: RichTextViewDelegate?
@objc open weak var dataSource: RichTextViewDataSource?
@objc open weak var delegate: RichTextViewDelegate?


// MARK: - Initializers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private class QRCodeScanningSessionMock: QRCodeScanningSession {
var hasCamera: Bool = true
var session: AVCaptureSession? = nil
var previewLayer: CALayer? = nil
var scanningDelegate: QRCodeScanningDelegate? = nil
weak var scanningDelegate: QRCodeScanningDelegate? = nil

var isConfigured: Bool = false
func configure() {
Expand Down

0 comments on commit 00c97fd

Please sign in to comment.