CombineExt provides a collection of operators, publishers and utilities for Combine, that are not provided by Apple themselves, but are common in other Reactive Frameworks and standards.
This project is setup with ViewController -> ChildViewController -> GrandChildViewController
The leak occurs only when ChildViewController sinks to the postsSubject
It seems that if a publisher is bound somewhere else, and then that same publisher is used with a withLatestFrom a retain cycle is introduced and Combine internally crashes
Seems like the DemandBuffer doesn't correctly forward completion information upstream if the upstream Subscriber is being used somewhere else which is why we are crashing in WithLatestFrom and share(replay: 1)
Repro Video Sample Project
This project is setup with
ViewController
->ChildViewController
->GrandChildViewController
The leak occurs only when
ChildViewController
sinks to thepostsSubject
It seems that if a publisher is bound somewhere else, and then that same publisher is used with a
withLatestFrom
a retain cycle is introduced and Combine internally crashesSeems like the
DemandBuffer
doesn't correctly forward completion information upstream if the upstream Subscriber is being used somewhere else which is why we are crashing in WithLatestFrom and share(replay: 1)