File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ internal protocol PlatformPlugin: Plugin { }
68
68
public typealias EnrichmentClosure = ( _ event: RawEvent ? ) -> RawEvent ?
69
69
public class ClosureEnrichment : Plugin {
70
70
public var type : PluginType = . enrichment
71
- public var analytics : Analytics ? = nil
71
+ public weak var analytics : Analytics ? = nil
72
72
73
73
internal let closure : EnrichmentClosure
74
74
Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ final class MemoryLeak_Tests: XCTestCase {
45
45
let macLifecycle = analytics. find ( pluginType: macOSLifecycleEvents. self) !
46
46
let macMonitor = analytics. find ( pluginType: macOSLifecycleMonitor. self) !
47
47
#endif
48
+
49
+ // test that enrichment closure isn't leaked. was previously a retain loop.
50
+ analytics. add { event in
51
+ return event
52
+ }
48
53
49
54
analytics. remove ( plugin: startupQueue)
50
55
analytics. remove ( plugin: segmentDest)
You can’t perform that action at this time.
0 commit comments