File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public class ConsentBlocker: EventPlugin {
1414 internal let store : Store
1515
1616 public var type : PluginType = . before
17- public var analytics : Segment . Analytics ?
17+ public weak var analytics : Segment . Analytics ?
1818
1919 public init ( destinationKey: String , store: Store ) {
2020 self . destinationKey = destinationKey
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import Sovran
1111
1212public class ConsentManager : EventPlugin {
1313 public let type : PluginType = . before
14- public var analytics : Analytics ? = nil
14+ public weak var analytics : Analytics ? = nil
1515 public let store = Store ( )
1616
1717 internal var provider : ConsentCategoryProvider
@@ -23,7 +23,10 @@ public class ConsentManager: EventPlugin {
2323 self . provider = provider
2424 self . consentChange = consentChanged
2525
26- self . provider. setChangeCallback ( notifyConsentChanged)
26+ // call notifyConsentChanged from a closure to avoid retain cycles.
27+ self . provider. setChangeCallback ( { [ weak self] in
28+ self ? . notifyConsentChanged ( )
29+ } )
2730 }
2831
2932 public func configure( analytics: Analytics ) {
You can’t perform that action at this time.
0 commit comments