mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
1 parent
71083a5586
commit
5400217bb6
1 file changed
+15
-1
@@ -119,8 +119,22 @@ where
|
||||
subscription.request(currentDemand)
|
||||
}
|
||||
|
||||
case .waitingForRequest, .subscribed, .finished:
|
||||
case .waitingForRequest, .subscribed:
|
||||
preconditionFailure()
|
||||
|
||||
case .finished:
|
||||
// We receive the upstream subscription requested by
|
||||
// `upstream.receive(subscriber: self)` above.
|
||||
//
|
||||
// But self has been cancelled since, so let's cancel this
|
||||
// upstream subscription that has turned purposeless.
|
||||
//
|
||||
// This cancellation avoids the bug described in
|
||||
// https://github.com/groue/GRDB.swift/pull/932
|
||||
// TODO: write a regression test.
|
||||
sideEffect = {
|
||||
subscription.cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user