Skip to content

Commit

Permalink
fix retain cycle in controller
Browse files Browse the repository at this point in the history
  • Loading branch information
brindy committed Sep 18, 2024
1 parent 1dcce2d commit cc01f3e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions DuckDuckGo/NetworkProtectionTunnelController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ final class NetworkProtectionTunnelController: TunnelController, TunnelSessionPr
private func subscribeToConfigurationChanges() {
notificationCenter.publisher(for: .NEVPNConfigurationChange)
.receive(on: DispatchQueue.main)
.sink { _ in
.sink { [weak self] _ in
guard let self = self else { return }
Task { @MainActor in
guard let manager = self.internalManager else {
return
Expand All @@ -346,7 +347,9 @@ final class NetworkProtectionTunnelController: TunnelController, TunnelSessionPr

private func subscribeToStatusChanges() {
notificationCenter.publisher(for: .NEVPNStatusDidChange)
.sink(receiveValue: handleStatusChange(_:))
.sink { [weak self] value in
self?.handleStatusChange(value)
}
.store(in: &cancellables)
}

Expand Down

0 comments on commit cc01f3e

Please sign in to comment.