From e69b042e57d79add20b05bfd73329b8d2e5744d3 Mon Sep 17 00:00:00 2001 From: Srdan Rasic Date: Sun, 18 Aug 2019 12:01:44 +0200 Subject: [PATCH] Fix issues in DisposableBag. --- Sources/Disposable.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Disposable.swift b/Sources/Disposable.swift index 7d034e1..1cf4abb 100644 --- a/Sources/Disposable.swift +++ b/Sources/Disposable.swift @@ -294,8 +294,10 @@ public final class DisposeBag: DisposeBagProtocol { /// A signal that fires `completed` event when the bag gets deallocated. public var deallocated: SafeSignal { subjectLock.lock(); defer { subjectLock.unlock() } - let subject = _subject ?? ReplaySubject() - return subject.toSignal() + if _subject == nil { + _subject = ReplayOneSubject() + } + return subject!.toSignal() } deinit {