[WIP] Disposable debugging

This commit is contained in:
Ali 2023-09-16 11:45:30 +02:00
parent 4bf474bbe5
commit 4330dc14d2
46 changed files with 168 additions and 75 deletions

View File

@ -109,7 +109,7 @@ private final class ContentNode: ASDisplayNode {
strongSelf.updateImage(image: image, size: size, spacing: spacing)
}
})
self.disposable = disposable
self.disposable = disposable.strict()
} else {
let image = generateImage(size, rotatedContext: { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
@ -342,7 +342,7 @@ public final class AnimatedAvatarSetView: UIView {
strongSelf.updateImage(image: image, size: size, spacing: spacing)
}
})
self.disposable = disposable
self.disposable = disposable.strict()
} else {
let image = generateImage(size, rotatedContext: { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))

View File

@ -129,7 +129,7 @@ public final class DirectAnimatedStickerNode: ASDisplayNode, AnimatedStickerNode
strongSelf.setupPlayback(lottieInstance: lottieInstance)
}
})
}).strict()
}
private func updatePlayback() {

View File

@ -94,7 +94,7 @@ private final class IconComponent: Component {
} else {
self?.image = image
}
})
}).strict()
} else {
if let tintColor = component.tintColor {
self.image = generateTintedImage(image: UIImage(bundleImageName: component.name), color: tintColor, backgroundColor: nil)
@ -1042,7 +1042,7 @@ final class AttachmentPanel: ASDisplayNode, UIScrollViewDelegate {
let _ = strongSelf.update(layout: layout, buttons: strongSelf.buttons, isSelecting: strongSelf.isSelecting, elevateProgress: strongSelf.elevateProgress, transition: .immediate)
}
}
})
}).strict()
}
deinit {

View File

@ -84,7 +84,7 @@ public final class AuthorizationSequenceController: NavigationController, MFMail
|> distinctUntilChanged
|> deliverOnMainQueue).start(next: { [weak self] state in
self?.updateState(state: state)
})
}).strict()
}
required public init(coder aDecoder: NSCoder) {

View File

@ -563,7 +563,7 @@ public final class AvatarNode: ASDisplayNode {
return
}
self.imageNode.contents = image?.cgImage
})
}).strict()
}
}
}

View File

@ -180,7 +180,7 @@ public final class AvatarVideoNode: ASDisplayNode {
strongSelf.animationFile = file
strongSelf.setupAnimation()
}
})
}).strict()
case let .sticker(packReference, fileId):
self.fileDisposable = (self.context.engine.stickers.loadedStickerPack(reference: packReference, forceActualized: false)
|> map { pack -> TelegramMediaFile? in
@ -194,7 +194,7 @@ public final class AvatarVideoNode: ASDisplayNode {
strongSelf.animationFile = file
strongSelf.setupAnimation()
}
})
}).strict()
}
}

View File

@ -1116,7 +1116,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
strongSelf.updateActionButton()
}
})
}).strict()
self.addSubnode(self.actionButtonPanelNode)
self.actionButtonPanelNode.addSubnode(self.actionButtonPanelSeparator)
@ -1140,7 +1140,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
strongSelf.passwordTip = hint
}
}
})
}).strict()
self.actionButtonPanelSeparator.backgroundColor = self.presentationData.theme.rootController.navigationBar.separatorColor
self.actionButtonPanelNode.backgroundColor = presentationData.theme.rootController.navigationBar.opaqueBackgroundColor

View File

@ -49,7 +49,7 @@ final class BotCheckoutPaymentMethodSheetController: ActionSheetController {
if let strongSelf = self {
strongSelf.theme = ActionSheetControllerTheme(presentationData: presentationData)
}
})
}).strict()
var items: [ActionSheetItem] = []

View File

@ -20,7 +20,7 @@ final class BotCheckoutPaymentShippingOptionSheetController: ActionSheetControll
if let strongSelf = self {
strongSelf.theme = ActionSheetControllerTheme(presentationData: presentationData)
}
})
}).strict()
var items: [ActionSheetItem] = []

View File

@ -319,7 +319,7 @@ final class BotReceiptControllerNode: ItemListControllerNode {
strongSelf.receiptData.set(.single((receipt.invoice, receipt.info, receipt.shippingOption, receipt.credentialsTitle, receipt.invoiceMedia, receipt.tipAmount)))
}
})
}).strict()
self.actionButton.addTarget(self, action: #selector(self.actionButtonPressed), forControlEvents: .touchUpInside)

View File

@ -293,7 +293,7 @@ public class BrowserScreen: ViewController {
}
strongSelf.contentState = state
strongSelf.requestLayout(transition: .immediate)
})
}).strict()
self.content?.onScrollingUpdate = { [weak self] update in
self?.onContentScrollingUpdate(update)

View File

@ -87,7 +87,7 @@ private final class MediaPreviewView: SimpleLayer {
}
strongSelf.contents = image.cgImage
}
})
}).strict()
}
}
}
@ -1185,7 +1185,7 @@ public final class CalendarMessageScreen: ViewController {
return
}
strongSelf.calendarSource.loadMore()
})
}).strict()
self.stateDisposable = (self.calendarSource.state
|> deliverOnMainQueue).start(next: { [weak self] state in
@ -1194,7 +1194,7 @@ public final class CalendarMessageScreen: ViewController {
}
strongSelf.calendarState = state
strongSelf.reloadMediaInfo()
})
}).strict()
}
deinit {

View File

@ -138,7 +138,7 @@ public final class CallListController: TelegramBaseController {
strongSelf.updateThemeAndStrings()
}
}
})
}).strict()
self.scrollToTop = { [weak self] in
self?.controllerNode.scrollToLatest()

View File

@ -198,7 +198,7 @@ final class ChatListContainerItemNode: ASDisplayNode {
}
if let filter, case let .filter(id, _, _, data) = filter, data.isShared {
self.pollFilterUpdatesDisposable = self.context.engine.peers.pollChatFolderUpdates(folderId: id).start()
self.pollFilterUpdatesDisposable = self.context.engine.peers.pollChatFolderUpdates(folderId: id).start().strict()
self.chatFilterUpdatesDisposable = (self.context.engine.peers.subscribedChatFolderUpdates(folderId: id)
|> deliverOnMainQueue).start(next: { [weak self] result in
guard let self else {
@ -221,7 +221,7 @@ final class ChatListContainerItemNode: ASDisplayNode {
self.updateLayout(size: size, insets: insets, visualNavigationHeight: visualNavigationHeight, originalNavigationHeight: originalNavigationHeight, inlineNavigationLocation: inlineNavigationLocation, inlineNavigationTransitionFraction: inlineNavigationTransitionFraction, storiesInset: storiesInset, transition: .animated(duration: 0.4, curve: .spring))
}
}
})
}).strict()
}
if case let .forum(peerId) = location {
@ -242,7 +242,7 @@ final class ChatListContainerItemNode: ASDisplayNode {
self.updateLayout(size: size, insets: insets, visualNavigationHeight: visualNavigationHeight, originalNavigationHeight: originalNavigationHeight, inlineNavigationLocation: inlineNavigationLocation, inlineNavigationTransitionFraction: inlineNavigationTransitionFraction, storiesInset: storiesInset, transition: .animated(duration: 0.4, curve: .spring))
}
}
})
}).strict()
}
}

View File

@ -401,7 +401,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
strongSelf.tabBarItem.badgeValue = compactNumericCountString(Int(count.0), decimalSeparator: presentationData.dateTimeFormat.decimalSeparator)
}
}
})
}).strict()
self.presentationDataDisposable = (context.sharedContext.presentationData
|> deliverOnMainQueue).start(next: { [weak self] presentationData in
@ -416,7 +416,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
strongSelf.updateThemeAndStrings()
}
}
})
}).strict()
if !previewing {
/*

View File

@ -149,7 +149,7 @@ final class ChatListEmptyNode: ASDisplayNode {
if let (size, insets) = self.validLayout {
self.updateLayout(size: size, insets: insets, transition: .immediate)
}
})
}).strict()
}
}

View File

@ -501,7 +501,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
strongSelf.updateTheme(theme: presentationData.theme)
}
}
})
}).strict()
if case let .forum(peerId) = location {
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId))

View File

@ -2656,7 +2656,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
}
})
}
})
}).strict()
self.recentListNode.beganInteractiveDragging = { _ in
interaction.dismissInput()
@ -2733,7 +2733,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
}
}
strongSelf.playlistLocation = playlistStateAndType?.1.playlistLocation
})
}).strict()
}
self.deletedMessagesDisposable = (context.account.stateManager.deletedMessages
@ -2758,7 +2758,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
return state
}
}
})
}).strict()
}
deinit {
@ -3056,7 +3056,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
}
}
}, completed: {
})
}).strict()
cancelImpl = {
self?.playlistPreloadDisposable?.dispose()
}

View File

@ -683,7 +683,7 @@ final class ChatListSearchMediaNode: ASDisplayNode, UIScrollViewDelegate {
for (_, itemNode) in strongSelf.visibleMediaItems {
itemNode.updateHiddenMedia()
}
})
}).strict()
}
deinit {

View File

@ -134,7 +134,7 @@ private final class ChatListSearchPendingPane {
|> deliverOnMainQueue).start(next: { [weak self] _ in
self?.isReady = true
hasBecomeReady(key)
})
}).strict()
}
deinit {

View File

@ -1832,7 +1832,7 @@ public final class ChatListNode: ListView {
|> distinctUntilChanged
self.suggestedChatListNotice.set(suggestedChatListNoticeSignal)
})
}).strict()
let storageInfo: Signal<Double?, NoError>
if !"".isEmpty, case .chatList(groupId: .root) = location, chatListFilter == nil {
@ -2723,7 +2723,7 @@ public final class ChatListNode: ListView {
return state
}
}
})
}).strict()
self.reorderItem = { [weak self] fromIndex, toIndex, transactionOpaqueState -> Signal<Bool, NoError> in
guard let strongSelf = self, let filteredEntries = (transactionOpaqueState as? ChatListOpaqueTransactionState)?.chatListView.filteredEntries else {

View File

@ -75,7 +75,7 @@ public final class ChatSendMessageActionSheetController: ViewController {
strongSelf.controllerNode.updatePresentationData(presentationData)
}
}
})
}).strict()
self.statusBar.statusBarStyle = .Hide
self.statusBar.ignoreInCall = true

View File

@ -93,7 +93,7 @@ public final class ReactionIconView: PortalSourceView {
}
strongSelf.file = files[fileId]
strongSelf.reloadFile()
})
}).strict()
}
}

View File

@ -151,7 +151,7 @@ public final class ReactionImageNode: ASDisplayNode {
strongSelf.iconNode.image = image
}
}
})
}).strict()
} else if let file = file {
self.size = file.dimensions?.cgSize ?? displayPixelSize
self.isAnimation = false
@ -169,7 +169,7 @@ public final class ReactionImageNode: ASDisplayNode {
strongSelf.iconNode.image = image
}
}
})
}).strict()
} else {
self.size = displayPixelSize
self.isAnimation = false

View File

@ -163,7 +163,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
}
strongSelf.file = file
strongSelf.updateReactionLayer()
})
}).strict()
}
} else {
let iconNode = ASImageNode()
@ -507,7 +507,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
}
strongSelf.file = file
strongSelf.updateReactionLayer()
})
}).strict()
}
} else {
self.file = nil
@ -825,7 +825,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
itemNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
}
}
})
}).strict()
}
deinit {

View File

@ -267,7 +267,7 @@ open class ViewControllerComponentContainer: ViewController {
strongSelf.containerLayoutUpdated(layout, transition: .immediate)
}
}
})
}).strict()
switch statusBarStyle {
case .none:

View File

@ -1385,7 +1385,7 @@ public final class ContactListNode: ASDisplayNode {
}
}
}
})
}).strict()
self.listNode.didEndScrolling = { [weak self] _ in
if let strongSelf = self {

View File

@ -184,7 +184,7 @@ public class ContactsController: ViewController {
strongSelf.updateThemeAndStrings()
}
}
})
}).strict()
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
self.authorizationDisposable = (combineLatest(DeviceAccess.authorizationStatus(subject: .contacts), combineLatest(context.sharedContext.accountManager.noticeEntry(key: ApplicationSpecificNotice.permissionWarningKey(permission: .contacts)!), context.account.postbox.preferencesView(keys: [PreferencesKeys.contactsSettings]), context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.contactSynchronizationSettings]))
@ -211,7 +211,7 @@ public class ContactsController: ViewController {
strongSelf.tabBarItem.badgeValue = status != .allowed && !suppressed ? "!" : nil
strongSelf.sortOrderPromise.set(.single(sortOrder))
}
})
}).strict()
} else {
self.sortOrderPromise.set(context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.contactSynchronizationSettings])
|> map { sharedData -> ContactsSortOrder in

View File

@ -143,7 +143,7 @@ final class ContactsControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
strongSelf.updateThemeAndStrings()
}
}
})
}).strict()
addNearbyImpl = { [weak self] in
if let strongSelf = self {
@ -243,7 +243,7 @@ final class ContactsControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
self.contactListNode.storySubscriptions.set(.single(storySubscriptions))
self.storiesReady.set(.single(true))
})*/
}).strict()*/
self.contactListNode.openStories = { [weak self] peer, sourceNode in
guard let self else {

View File

@ -67,7 +67,7 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr
strongSelf.updateThemeAndStrings()
}
}
})
}).strict()
self.searchContentNode = NavigationBarSearchContentNode(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search, activate: { [weak self] in
self?.activateSearch()

View File

@ -325,7 +325,7 @@ final class InviteContactsControllerNode: ASDisplayNode {
strongSelf.updateThemeAndStrings()
}
}
})
}).strict()
let selectionStateSignal = self.selectionStatePromise.get()
let transition: Signal<InviteContactsTransition, NoError>
@ -428,7 +428,7 @@ final class InviteContactsControllerNode: ASDisplayNode {
self.disposable = transition.start(next: { [weak self] transition in
self?.enqueueTransition(transition)
})
}).strict()
shareImpl = { [weak self] in
if let strongSelf = self {

View File

@ -210,7 +210,7 @@ public final class ContextActionNode: ASDisplayNode, ContextActionNodeProtocol {
return
}
strongSelf.iconNode.image = image
})
}).strict()
}
}

View File

@ -804,7 +804,7 @@ final class ContextActionsContainerNode: ASDisplayNode {
strongSelf.tip = tip
requestLayout()
})
}).strict()
}
}

View File

@ -2540,7 +2540,7 @@ public final class ContextController: ViewController, StandalonePresentableContr
return
}
strongSelf.dismiss(result: .default, completion: {})
})
}).strict()
case let .reference(referenceSource):
self.statusBar.statusBarStyle = .Ignore
@ -2552,7 +2552,7 @@ public final class ContextController: ViewController, StandalonePresentableContr
return
}
strongSelf.dismiss(result: .default, completion: {})
})
}).strict()
case let .extracted(extractedSource):
if extractedSource.blurBackground {
self.statusBar.statusBarStyle = .Hide
@ -2567,7 +2567,7 @@ public final class ContextController: ViewController, StandalonePresentableContr
return
}
strongSelf.dismiss(result: .default, completion: {})
})
}).strict()
case .controller:
self.statusBar.statusBarStyle = .Hide
}

View File

@ -296,7 +296,7 @@ private final class ContextControllerActionsListActionItemNode: HighlightTrackin
return
}
strongSelf.iconNode.image = image
})
}).strict()
}
} else if let image = self.iconNode.image {
iconSize = image.size
@ -1122,7 +1122,7 @@ final class ContextControllerActionsStackNode: ASDisplayNode {
}
strongSelf.tip = tip
requestUpdate(.immediate)
})
}).strict()
}
}

View File

@ -26,7 +26,7 @@ public final class DateSelectionActionSheetController: ActionSheetController {
if let strongSelf = self {
strongSelf.theme = ActionSheetControllerTheme(presentationData: presentationData)
}
})
}).strict()
self._ready.set(.single(true))

View File

@ -56,7 +56,7 @@ final class NavigationOverlayContainer: ASDisplayNode {
strongSelf.isReadyUpdated?()
}
}
})
}).strict()
}
deinit {

View File

@ -559,7 +559,7 @@ public class StickerPickerScreen: ViewController {
} else {
strongSelf.gifMode = hasRecentGifs ? .recent : .trending
}
})
}).strict()
self.trendingGifsPromise.set(.single(nil))
self.trendingGifsPromise.set(paneGifSearchForQuery(context: context, query: "", offset: nil, incompleteResults: true, delayRequest: false, updateActivity: nil)

View File

@ -402,7 +402,7 @@ public final class ChatMediaInputTrendingPane: ChatMediaInputPane {
strongSelf.didSetReady = true
strongSelf._ready.set(.single(Void()))
}
})
}).strict()
}
public override func updateLayout(size: CGSize, topInset: CGFloat, bottomInset: CGFloat, isExpanded: Bool, isVisible: Bool, deviceMetrics: DeviceMetrics, transition: ContainedViewLayoutTransition) {

View File

@ -422,7 +422,7 @@ private final class FeaturedStickersScreenNode: ViewControllerTracingNode {
strongSelf.didSetReady = true
strongSelf._ready.set(.single(true))
}
})
}).strict()
self.controller?.searchNavigationNode?.setQueryUpdated({ [weak self] query, languageCode in
guard let strongSelf = self else {

View File

@ -1120,7 +1120,7 @@ public class GalleryController: ViewController, StandalonePresentableController,
if let strongSelf = self, strongSelf.traceVisibility() {
let _ = strongSelf.context.engine.messages.addSecretChatMessageScreenshot(peerId: id.peerId).start()
}
})
}).strict()
}
default:
break

View File

@ -156,7 +156,7 @@ public final class GalleryPagerNode: ASDisplayNode, UIScrollViewDelegate, UIGest
if let strongSelf = self {
strongSelf.pagingEnabled = pagingEnabled
}
})
}).strict()
}
deinit {

View File

@ -516,7 +516,7 @@ private final class PictureInPictureContentImpl: NSObject, PictureInPictureConte
strongSelf.pictureInPictureController?.invalidatePlaybackState()
}
}
})
}).strict()
}
deinit {
@ -938,7 +938,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
} else {
strongSelf.footerContentNode.setFramePreviewImage(image: nil)
}
})
}).strict()
self.alternativeDismiss = { [weak self] in
guard let strongSelf = self, strongSelf.hasPictureInPicture else {
@ -973,7 +973,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
if let strongSelf = self {
strongSelf.updateControlsVisibility(false)
}
})
}).strict()
}
deinit {

View File

@ -4,6 +4,32 @@ public protocol Disposable: AnyObject {
func dispose()
}
public final class StrictDisposable: Disposable {
private let disposable: Disposable
private let isDisposed = Atomic<Bool>(value: false)
public init(_ disposable: Disposable) {
self.disposable = disposable
}
deinit {
#if DEBUG
assert(self.isDisposed.with({ $0 }))
#endif
}
public func dispose() {
let _ = self.isDisposed.swap(true)
self.disposable.dispose()
}
}
public extension Disposable {
func strict() -> Disposable {
return StrictDisposable(self)
}
}
final class _EmptyDisposable: Disposable {
func dispose() {
}

View File

@ -23,18 +23,37 @@ public func |> <T, U>(value: T, function: ((T) -> U)) -> U {
return function(value)
}
private final class SubscriberDisposable<T, E> : Disposable {
private final class SubscriberDisposable<T, E>: Disposable, CustomStringConvertible {
private let subscriber: Subscriber<T, E>
private let disposable: Disposable
init(subscriber: Subscriber<T, E>, disposable: Disposable) {
private var lock = pthread_mutex_t()
private var disposable: Disposable?
init(subscriber: Subscriber<T, E>, disposable: Disposable?) {
self.subscriber = subscriber
self.disposable = disposable
pthread_mutex_init(&self.lock, nil)
}
deinit {
pthread_mutex_destroy(&self.lock)
}
func dispose() {
subscriber.markTerminatedWithoutDisposal()
disposable.dispose()
self.subscriber.markTerminatedWithoutDisposal()
var disposeItem: Disposable?
pthread_mutex_lock(&self.lock)
disposeItem = self.disposable
self.disposable = nil
pthread_mutex_unlock(&self.lock)
disposeItem?.dispose()
}
public var description: String {
return "SubscriberDisposable { disposable: \(self.disposable == nil ? "nil" : "hasValue") }"
}
}

View File

@ -1,13 +1,21 @@
import Foundation
public final class Subscriber<T, E> {
#if DEBUG
// Signals keep themselves in memory until terminated (dispose, putError, putCompletion)
private final class LiveSubscribers {
var dict: [ObjectIdentifier: AnyObject] = [:]
}
private let liveSubscribers = Atomic<LiveSubscribers>(value: LiveSubscribers())
#endif
public final class Subscriber<T, E>: CustomStringConvertible {
private var next: ((T) -> Void)!
private var error: ((E) -> Void)!
private var completed: (() -> Void)!
private var lock = pthread_mutex_t()
private var terminated = false
internal var disposable: Disposable!
internal var disposable: Disposable?
public init(next: ((T) -> Void)! = nil, error: ((E) -> Void)! = nil, completed: (() -> Void)! = nil) {
self.next = next
@ -16,6 +24,10 @@ public final class Subscriber<T, E> {
pthread_mutex_init(&self.lock, nil)
}
public var description: String {
return "Subscriber { next: \(self.next == nil ? "nil" : "hasValue"), error: \(self.error == nil ? "nil" : "hasValue"), completed: \(self.completed == nil ? "nil" : "hasValue"), disposable: \(self.disposable == nil ? "nil" : "hasValue"), terminated: \(self.terminated) }"
}
deinit {
var freeDisposable: Disposable?
pthread_mutex_lock(&self.lock)
@ -34,6 +46,12 @@ public final class Subscriber<T, E> {
}
internal func assignDisposable(_ disposable: Disposable) {
#if DEBUG
liveSubscribers.with { impl in
//let _ = impl.dict[ObjectIdentifier(self)] = self
}
#endif
var dispose = false
pthread_mutex_lock(&self.lock)
if self.terminated {
@ -49,14 +67,33 @@ public final class Subscriber<T, E> {
}
internal func markTerminatedWithoutDisposal() {
var freeDisposable: Disposable?
pthread_mutex_lock(&self.lock)
if !self.terminated {
self.terminated = true
self.next = nil
self.error = nil
self.completed = nil
if let disposable = self.disposable {
freeDisposable = disposable
self.disposable = nil
}
}
pthread_mutex_unlock(&self.lock)
if let freeDisposableValue = freeDisposable {
withExtendedLifetime(freeDisposableValue, {
})
freeDisposable = nil
}
#if DEBUG
liveSubscribers.with { impl in
let _ = impl.dict.removeValue(forKey: ObjectIdentifier(self))
}
#endif
}
public func putNext(_ next: T) {
@ -86,7 +123,6 @@ public final class Subscriber<T, E> {
self.terminated = true
disposeDisposable = self.disposable
self.disposable = nil
}
pthread_mutex_unlock(&self.lock)
@ -97,6 +133,12 @@ public final class Subscriber<T, E> {
if let disposeDisposable = disposeDisposable {
disposeDisposable.dispose()
}
#if DEBUG
liveSubscribers.with { impl in
let _ = impl.dict.removeValue(forKey: ObjectIdentifier(self))
}
#endif
}
public func putCompletion() {
@ -141,5 +183,11 @@ public final class Subscriber<T, E> {
if let disposeDisposable = disposeDisposable {
disposeDisposable.dispose()
}
#if DEBUG
liveSubscribers.with { impl in
let _ = impl.dict.removeValue(forKey: ObjectIdentifier(self))
}
#endif
}
}