Skip to content

Commit

Permalink
Fix issues in DisposableBag.
Browse files Browse the repository at this point in the history
  • Loading branch information
srdanrasic committed Aug 18, 2019
1 parent 9ef04a9 commit e69b042
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Disposable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,10 @@ public final class DisposeBag: DisposeBagProtocol {
/// A signal that fires `completed` event when the bag gets deallocated.
public var deallocated: SafeSignal<Void> {
subjectLock.lock(); defer { subjectLock.unlock() }
let subject = _subject ?? ReplaySubject()
return subject.toSignal()
if _subject == nil {
_subject = ReplayOneSubject()
}
return subject!.toSignal()
}

deinit {
Expand Down

0 comments on commit e69b042

Please sign in to comment.