Skip to content

Commit 470657b

Browse files
committed
Fix potential issues with exclusive memory access.
1 parent d474eaa commit 470657b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/Observer.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ public final class AtomicObserver<Element, Error: Swift.Error>: ObserverProtocol
117117

118118
public func dispose() {
119119
observerLock.lock()
120-
observer = nil
120+
withExtendedLifetime(self.observer) {
121+
self.observer = nil
122+
}
121123
observerLock.unlock()
122124
disposablesLock.lock()
123125
self.upstreamDisposables.forEach { $0.dispose() }

0 commit comments

Comments
 (0)